Module: RTM::IO::TOXTM2::Association

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

Instance Method Summary

Instance Method Details

- (Object) to_xtm2

returns the XTM 2.0 representation of this association as an REXML::Element



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

def to_xtm2
  warn("TOXTM2: Warning: outputting invalid Association #{self}") unless valid?
  # association = element association { reifiable, type, scope?, role+ }
  x = REXML::Element.new 'association'
  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 << TOXTM2.scope(scope) unless scope.empty?
  roles.each { |r| x << r.to_xtm2 }
  x
end