Class: VORuby::VOResource::Mapping::TextEnumerationNode

Inherits:
XML::Mapping::TextNode
  • Object
show all
Includes:
Misc
Defined in:
lib/voruby/resources/nodes.rb

Instance Method Summary collapse

Methods included from Misc

#raise_error

Instance Method Details

#extract_attr_value(xml) ⇒ Object



55
56
57
58
59
60
# File 'lib/voruby/resources/nodes.rb', line 55

def extract_attr_value(xml)
  txt = default_when_xpath_err{ @path.first(xml).text }
  self.raise_error("#{txt} in #{xml.parent}") if !@options[:choices].include?(txt)

  return txt
end

#set_attr_value(xml, value) ⇒ Object



62
63
64
65
# File 'lib/voruby/resources/nodes.rb', line 62

def set_attr_value(xml, value)
  self.raise_error(value) unless @options[:choices].include?(value)
  @path.first(xml, :ensure_created => true).text = value.to_s
end