Module: RTM::AR::IO::TOXTM2::AssociationRole

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

Instance Method Summary collapse

Instance Method Details

#to_xtm2Object



135
136
137
138
139
140
141
142
143
144
# File 'lib/rtm/activerecord/io/to_xtm2.rb', line 135

def to_xtm2
  warn("TOXTM2: Warning: outputting invalid AssociationRole #{self}") unless valid?
  # role = element role { reifiable, type, topicRef }
  x = REXML::Element.new 'role'
  x.add_attribute('reifier', reifier.xtm2_id) if reifier
  item_identifiers.each { |ii| x << TOXTM2.locator(ii) } # itemIdentity
  x << TOXTM2.type(type) if type
  x << player.to_xtm2_ref if player
  x
end