Module: RTM::IO::TOXTM1::Name

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

Instance Method Summary

Instance Method Details

- (Object) to_xtm1



104
105
106
107
108
109
110
111
112
113
114
115
# File 'rtm/lib/rtm/io/to_xtm1.rb', line 104

def to_xtm1
  warn("TOXTM1: 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.xtm1_id) if reifier
  item_identifiers.each { |ii| x << TOXTM1.ii(ii) } # itemIdentity
  x << TOXTM1.type(type) if type
  x << TOXTM1.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_xtm1 }
  x
end