Module: RTM::IO::TOXTM2::Name

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

Instance Method Summary

Instance Method Details

- (Object) to_xtm2



106
107
108
109
110
111
112
113
114
115
116
117
# File 'rtm/lib/rtm/io/to_xtm2.rb', line 106

def to_xtm2
  warn("TOXTM2: Warning: outputting invalid Name #{self}") unless valid?
  # name = element name { reifiable, type?, scope?, value, variant* }
  x = REXML::Element.new 'name'
  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?
  (x << REXML::Element.new('value')).text = value # adds the value within a value-element
  variants.each { |v| x << v.to_xtm2 }
  x
end