Module: Corefines::Object::InstanceValues
- Defined in:
- lib/corefines/object.rb
Instance Method Summary collapse
-
#instance_values ⇒ Hash
A hash with symbol keys that maps instance variable names without "@" to their corresponding values.
Instance Method Details
#instance_values ⇒ Hash
Returns a hash with symbol keys that maps instance variable names without "@" to their corresponding values.
189 190 191 192 193 194 195 196 197 198 |
# File 'lib/corefines/object.rb', line 189 module InstanceValues refine ::Object do def instance_values ary = instance_variables.map do |name| [ name[1..-1].to_sym, instance_variable_get(name) ] end ::Hash[ary] end end end |