Module: Commontator::JsonArrayCoder
- Defined in:
- app/models/commontator/json_array_coder.rb
Class Method Summary collapse
Class Method Details
.dump(obj) ⇒ Object
7 8 9 |
# File 'app/models/commontator/json_array_coder.rb', line 7 def self.dump(obj) obj.is_a?(Array) ? JSON.dump(obj) : '[]' end |
.load(data) ⇒ Object
2 3 4 5 |
# File 'app/models/commontator/json_array_coder.rb', line 2 def self.load(data) obj = JSON.load(data) obj.is_a?(Array) ? obj : [] end |