Sha256: fe62afff3152136e30cd94f9137405a7331a87d6b0d305d055e9bd0e4d1b5eb9

Contents?: true

Size: 434 Bytes

Versions: 21

Compression:

Stored size: 434 Bytes

Contents

require "json"

module Ohm
  class Model
    # Export a JSON representation of the model by encoding `to_hash`.
    def to_json(*args)
      to_hash.to_json(*args)
    end
  end

  module Collection
    # Sugar for to_a.to_json for all types of Sets
    def to_json(*args)
      to_a.to_json(*args)
    end
  end

  class List
    # Sugar for to_a.to_json for lists.
    def to_json(*args)
      to_a.to_json(*args)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ohm-1.4.0 lib/ohm/json.rb
ohm-2.0.0.alpha5 lib/ohm/json.rb
ohm-2.0.0.alpha4 lib/ohm/json.rb
ohm-2.0.0.alpha3 lib/ohm/json.rb
ohm-2.0.0.alpha2 lib/ohm/json.rb
ohm-2.0.0.alpha1 lib/ohm/json.rb
ohm-1.3.2 lib/ohm/json.rb
ohm-1.3.1 lib/ohm/json.rb
ohm-1.3.0 lib/ohm/json.rb
ohm-1.2.0 lib/ohm/json.rb
ohm-1.1.2 lib/ohm/json.rb
ohm-1.1.1 lib/ohm/json.rb
ohm-1.1.0 lib/ohm/json.rb
ohm-1.1.0.rc1 lib/ohm/json.rb
ohm-1.0.2 lib/ohm/json.rb
ohm-1.0.1 lib/ohm/json.rb
ohm-1.0.0 lib/ohm/json.rb
ohm-1.0.0.rc4 lib/ohm/json.rb
ohm-1.0.0.rc3 lib/ohm/json.rb
ohm-1.0.0.rc2 lib/ohm/json.rb