Module: RTM::AR::IO::TOJTM::Occurrence

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



102
103
104
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 102

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

#to_jtm_hash(*a) ⇒ Object



92
93
94
95
96
97
98
99
100
101
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 92

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