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
-
#to_hash ⇒ Hash
Creates a Hash representation of self.
Instance Method Details
#to_hash ⇒ Hash
Creates a Hash representation of self
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 |