Module: RTM::IO::ToHash::TopicMap

Defined in:
rtm/lib/rtm/io/to_hash.rb

Instance Method Summary

Instance Method Details

- (Object) to_hash

Returns the Hash representation of this topic map.

The returned Hash holds information about the :reifier, the :item_identifiers, the :topics and :associations.

:call-seq:

  to_hash -> Hash


18
19
20
21
22
23
24
25
# File 'rtm/lib/rtm/io/to_hash.rb', line 18

def to_hash
  h={}
  h[:reifier] = reifier.reference if reifier
  h[:item_identifiers] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty?
  h[:topics] = topics.map{|i| i.to_hash} unless topics.empty?
  h[:associations] = associations.map{|i| i.to_hash} unless associations.empty?
  h
end