Sha256: f2602ee75fa8a55fa733e69d652ed5eb43132f5c06393c901d71f2bc860ea8ec

Contents?: true

Size: 198 Bytes

Versions: 13

Compression:

Stored size: 198 Bytes

Contents

module Commontator::JsonArrayCoder
  def self.load(data)
    obj = JSON.load(data)
    obj.is_a?(Array) ? obj : []
  end

  def self.dump(obj)
    obj.is_a?(Array) ? JSON.dump(obj) : '[]'
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
commontator-7.0.1 app/models/commontator/json_array_coder.rb
commontator-7.0.0 app/models/commontator/json_array_coder.rb
commontator-6.3.2 app/models/commontator/json_array_coder.rb
commontator-6.3.1 app/models/commontator/json_array_coder.rb
commontator-6.3.0 app/models/commontator/json_array_coder.rb
commontator-6.2.1 app/models/commontator/json_array_coder.rb
commontator-6.2.0 app/models/commontator/json_array_coder.rb
commontator-6.1.1 app/models/commontator/json_array_coder.rb
commontator-6.1.0 app/models/commontator/json_array_coder.rb
commontator-6.0.1 app/models/commontator/json_array_coder.rb
commontator-6.0.0 app/models/commontator/json_array_coder.rb
commontator-6.0.0.pre.2 app/models/commontator/json_array_coder.rb
commontator-6.0.0.pre.1 app/models/commontator/json_array_coder.rb