Module: RTM::AR::IO::TOJTM::Variant

Defined in:
lib/rtm/activerecord/io/to_jtm.rb

Instance Method Summary collapse

Instance Method Details

#to_jtm(*a) ⇒ Object Also known as: to_json



132
133
134
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 132

def to_jtm(*a)
  to_jtm_hash.to_json(*a)
end

#to_jtm_hash(*a) ⇒ Object



124
125
126
127
128
129
130
131
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 124

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['value'] = value if value
  j['scope'] = scope.map{|i| i.to_jtm_hash} unless scope.empty?
  j
end