Module: Locomotive::Steam::Models::Concerns::ToJson
- Included in:
- Entity
- Defined in:
- lib/locomotive/steam/models/concerns/to_json.rb
Instance Method Summary collapse
Instance Method Details
#as_json(options = nil) ⇒ Object
18 19 20 |
# File 'lib/locomotive/steam/models/concerns/to_json.rb', line 18 def as_json( = nil) to_hash.as_json() end |
#to_hash ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/locomotive/steam/models/concerns/to_json.rb', line 8 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 |
#to_json ⇒ Object
22 23 24 |
# File 'lib/locomotive/steam/models/concerns/to_json.rb', line 22 def to_json as_json.to_json end |