Module: StoreComplex
- Defined in:
- lib/store_complex.rb,
lib/store_complex/version.rb
Defined Under Namespace
Modules: Accessor
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Class Method Details
.obj_to_store(value) ⇒ Object
6 7 8 9 |
# File 'lib/store_complex.rb', line 6 def self.obj_to_store(value) return nil if value.nil? JSON.generate(value.is_a?(Hash) ? value : Array(value)) end |
.store_to_obj(value) ⇒ Object
10 11 12 13 |
# File 'lib/store_complex.rb', line 10 def self.store_to_obj(value) return [] if value.nil? JSON.parse(value) end |