R
Ruby Freak
Hi and thanks in advance for your help.
I have been pounding every Ruby and Rails book I can find, desperately
attempting to move beyond newbie status.My latest foray has taken me
into the native 2.0.2 Rails::Info module. I am reading what I think is
native ruby code but I can't seem to figure out what is being passed
to map and find. Could someone please explain (name, ) in the
following code?
Thanks again.
module Rails
module Info
mattr_accessor roperties
class << (@@properties = [])
def names
map {|(name, )| name}
end
def value_for(property_name)
find {|(name, )| name == property_name}.last rescue nil
end
end
I have been pounding every Ruby and Rails book I can find, desperately
attempting to move beyond newbie status.My latest foray has taken me
into the native 2.0.2 Rails::Info module. I am reading what I think is
native ruby code but I can't seem to figure out what is being passed
to map and find. Could someone please explain (name, ) in the
following code?
Thanks again.
module Rails
module Info
mattr_accessor roperties
class << (@@properties = [])
def names
map {|(name, )| name}
end
def value_for(property_name)
find {|(name, )| name == property_name}.last rescue nil
end
end