Module: RTM::AR::IO::TOJTM::TopicMap
- 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 topic map.
Instance Method Details
#to_jtm(*a) ⇒ Object Also known as: to_json
20 21 22 |
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 20 def to_jtm(*a) to_jtm_hash.to_json(*a) end |
#to_jtm_hash(*a) ⇒ Object
returns the JTM representation of this topic map
11 12 13 14 15 16 17 18 19 |
# File 'lib/rtm/activerecord/io/to_jtm.rb', line 11 def to_jtm_hash(*a) j={} #j['base_locator'] = base_locator, # with absolute item_identifiers its not needed j['reifier'] = reifier.to_jtm_ref if reifier j['item_identifiers'] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty? j['topics'] = topics.map{|i| i.to_jtm_hash} unless topics.empty? j['associations'] = associations.map{|i| i.to_jtm_hash} unless associations.empty? j end |