Sha256: 452dd2c27b5aee64ae66271c830c4a351ba5fb0b8cd0d9bbdefc9e061a459a42

Contents?: true

Size: 576 Bytes

Versions: 47

Compression:

Stored size: 576 Bytes

Contents

module Locomotive
  module Steam
    module Models
      module Concerns

        module ToJson

          def to_hash
            {}.tap do |_attributes|
              attributes.each do |key, value|
                next if value && value.respond_to?(:repository) # skip associations

                _attributes[key.to_s] = value
              end
            end
          end

          def as_json(options = nil)
            to_hash.as_json(options)
          end

          def to_json
            as_json.to_json
          end

        end

      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.8.0.alpha1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.7.1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.7.0 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.6.1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.6.0 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.6.0.rc1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.6.0.beta1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.3 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.4.1 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/models/concerns/to_json.rb
locomotivecms_steam-1.4.0.rc2 lib/locomotive/steam/models/concerns/to_json.rb