Module: DecoLite::Hashable
- Included in:
- Model
- Defined in:
- lib/deco_lite/hashable.rb
Overview
Provides methods to convert the object to a Hash.
Instance Method Summary collapse
Instance Method Details
#to_h ⇒ Object
6 7 8 9 10 |
# File 'lib/deco_lite/hashable.rb', line 6 def to_h field_names.each_with_object({}) do |field_name, hash| hash[field_name] = public_send field_name end end |