Method: Axlsx.instance_values_for

Defined in:
lib/axlsx.rb

.instance_values_for(object) ⇒ Object

I am a very big fan of activesupports instance_values method, but do not want to require nor include the entire library just for this one method.

Defining as a class method on Axlsx to refrain from monkeypatching Object for all users of this gem.



52
53
54
# File 'lib/axlsx.rb', line 52

def self.instance_values_for(object)
  Hash[object.instance_variables.map { |name| [name.to_s[1..-1], object.instance_variable_get(name)] }]
end