This post originated from an RSS feed registered with Ruby Buzz
by Eigen Class.
Original Post: Ruby HEAD's been evolving in the last 4 months
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
It's been a while since the last update to my summary of changes in Ruby 1.9 and there are lots of new methods, a few syntactic changes and
fundamental changes in relation between Symbols and Strings.
A couple methods were added to test whether an instance variable exists:
"".instance_variable_defined? :@a # => false
There's also Module#class_variable which is IMO misnamed:
class X; @a = 1 end
X.class_variable_defined? :@a # => true
X.class_variable_defined? :@@a
# ~> in `Module#class_variable_defined?': `@@a' is not allowed as an instance variable name (NameError)
@a is not a class variable (that'd be @@a) but a class instance variable.
This looks like a bug.
Syntax
Multiple splats were already allowed, and now you can also use mandatory
arguments after optional ones: