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&.serializable_hash || {} end |
#load(hash) ⇒ Object
11 12 13 14 15 |
# File 'lib/form_core/coders/hash_coder.rb', line 11 def load(hash) return new_or_raise_decoding_error if hash.nil? || !hash.respond_to?(:to_h) object_class.new valid_attributes(hash) end |