Module: Bixby::Hashify

Included in:
CommandSpec, Jsonify
Defined in:
lib/bixby-common/util/hashify.rb

Overview

Adds to_hash method to an Object

Instance Method Summary collapse

Instance Method Details

#to_hashHash

Creates a Hash representation of self

Returns:

  • (Hash)


10
11
12
# File 'lib/bixby-common/util/hashify.rb', line 10

def to_hash
  self.instance_variables.inject({}) { |m,v| m[v[1,v.length].to_sym] = instance_variable_get(v); m }
end