Class Index [+]



Public Instance Methods

instance_variables_set_to(object) click to toggle source

Set instance variables by key and value only if object respond to access method for variable.

    # File lib/postage/extensions.rb, line 17
17:   def instance_variables_set_to(object)
18:     collect do |variable, value|
19:       object.instance_variable_set("@#{variable}", value) if object.respond_to? variable
20:     end
21:     object
22:   end
symbolize_keys() click to toggle source

Only symbolize all keys, including all key in sub-hashes.

    # File lib/postage/extensions.rb, line 4
 4:   def symbolize_keys
 5:     self.inject({}) do |hash, (key, value)|
 6:       hash[key.to_sym] = if value.kind_of? Hash
 7:                            value.symbolize_keys
 8:                          else
 9:                            value
10:                          end
11:       hash
12:     end
13:   end

Disabled; run with --debug to generate this.


Generated with the Darkfish Rdoc Generator 1.1.6.