G
gwtmp01
This really surprises me:
3.instance_variable_set("@unbelievable", "believe it!")
puts 3.instance_variable_get("@unbelievable") # -> "believe it!"
which led me to:
class Fixnum
attr_accessor :note
end
13.note = "a baker's dozen"
25.note = "5 squared"
notes = [13, 21, 25].collect { |x| x.note } # ["a baker's dozen",
nil, "5 squared"]
Am I the only person with their jaw on the ground?
Gary Wright
3.instance_variable_set("@unbelievable", "believe it!")
puts 3.instance_variable_get("@unbelievable") # -> "believe it!"
which led me to:
class Fixnum
attr_accessor :note
end
13.note = "a baker's dozen"
25.note = "5 squared"
notes = [13, 21, 25].collect { |x| x.note } # ["a baker's dozen",
nil, "5 squared"]
Am I the only person with their jaw on the ground?
Gary Wright