Class: FormCore::HashCoder
- Defined in:
- lib/form_core/coders/hash_coder.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Coder
Instance Method Summary collapse
Methods inherited from Coder
Constructor Details
This class inherits a constructor from FormCore::Coder
Instance Method Details
#dump(obj) ⇒ Object
7 8 9 |
# File 'lib/form_core/coders/hash_coder.rb', line 7 def dump(obj) obj&.to_h || {} end |
#load(hash) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/form_core/coders/hash_coder.rb', line 11 def load(hash) if hash.nil? || !hash.respond_to?(:to_h) return new_or_raise_decoding_error end object_class.new hash.to_h end |