module Corefines::Object::InstanceValues
@!method instance_values
@example class C def initialize(x, y) @x, @y = x, y end end C.new(0, 1).instance_values => {x: 0, y: 1} @return [Hash] a hash with symbol keys that maps instance variable names without "@" to their corresponding values.
Public Instance Methods
instance_values()
click to toggle source
# File lib/corefines/object.rb, line 191 def instance_values ary = instance_variables.map do |name| [ name[1..-1].to_sym, instance_variable_get(name) ] end ::Hash[ary] end