Sha256: 4c1b69b6f122055a35849988257289781a2167052bcf50178cbac5c0a6ed3d05

Contents?: true

Size: 318 Bytes

Versions: 7

Compression:

Stored size: 318 Bytes

Contents

require "json"

module Sohm
  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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sohm-0.10.5 lib/sohm/json.rb
sohm-0.10.4 lib/sohm/json.rb
sohm-0.10.3 lib/sohm/json.rb
sohm-0.10.2 lib/sohm/json.rb
sohm-0.10.1 lib/sohm/json.rb
sohm-0.10.0 lib/sohm/json.rb
sohm-0.9.0 lib/sohm/json.rb