Module: RTM::AR::IO::TOJTM::Association
- Defined in:
- lib/rtm/activerecord/io/to_jtm.rb
Instance Method Summary collapse
- #to_jtm(*a) ⇒ Object (also: #to_json)
-
#to_jtm_hash(*a) ⇒ Object
returns the JTM representation of this association.
Instance Method Details
#to_jtm(*a) ⇒ Object Also known as: to_json
67 68 69 |
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 67 def to_jtm(*a) to_jtm_hash.to_json(*a) end |
#to_jtm_hash(*a) ⇒ Object
returns the JTM representation of this association
58 59 60 61 62 63 64 65 66 |
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 58 def to_jtm_hash(*a) j={} j['reifier'] = reifier.to_jtm_ref if reifier j['item_identifiers'] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty? j['type'] = type.to_jtm_ref if type j['scope'] = scope.map{|i| i.to_jtm_hash} unless scope.empty? j['roles'] = roles.map{|i| i.to_jtm_hash} unless roles.empty? j end |