#10 ✓resolved
Benedict Eastaugh

Incorrect use of || breaks helpers in Ruby 1.9

Reported by Benedict Eastaugh | January 18th, 2010 @ 01:36 PM

The problem with the following line ought to be obvious: '@staticmatic', being truthy, will always be the result of the disjunction.

@scope.instance_variable_set(var, nil) unless var == ('@staticmatic' || :@staticmatic)

This is a problem on Ruby 1.9, where instance variables names are always set to symbols, even if strings are used in the setters (as they are in Staticmatic). Consider this example script:

obj = Object.new
obj.instance_variable_set("@myvar", "Test.")
obj.instance_variables.each do |var|
  puts var.class
end

Ruby 1.8.x will print String; Ruby 1.9.x will print Symbol.

Patch is attached.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Light-weight static site framework

Shared Ticket Bins

People watching this ticket

Attachments

Tags

Pages