Module: RTM::AR::IO::TOYAML::TopicMap

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

Instance Method Summary collapse

Instance Method Details

#to_yaml(*a) ⇒ Object

returns the YAML representation of this topic map



20
21
22
# File 'lib/rtm/activerecord/io/to_yaml.rb', line 20

def to_yaml(*a)
  to_yaml_hash.to_yaml(*a)
end

#to_yaml_hash(*a) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/rtm/activerecord/io/to_yaml.rb', line 10

def to_yaml_hash(*a)
  y={}
  #j['base_locator'] = base_locator, # with absolute item_identifiers its not needed

  y['reifier'] = reifier.to_yaml_ref if reifier
  y['item_identifiers'] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty?
  y['topics'] = topics.map{|i| i.to_yaml_hash} unless topics.empty?
  y['associations'] = associations.map{|i| i.to_yaml_hash} unless associations.empty?
  y
end