Class: RCAP::Geocode
- Defined in:
- lib/generators/rcap/models/templates/models/geocode.rb
Constant Summary collapse
- XML_ELEMENT_NAME =
:nodoc:
'geocode'
- XPATH =
:nodoc:
"cap:#{ XML_ELEMENT_NAME }"
Constants inherited from Parameter
Parameter::NAME_ELEMENT_NAME, Parameter::NAME_XPATH, Parameter::VALUE_ELEMENT_NAME, Parameter::VALUE_XPATH
Instance Attribute Summary
Attributes inherited from Parameter
Class Method Summary collapse
Instance Method Summary collapse
-
#to_xml_element ⇒ Object
:nodoc:.
Methods inherited from Parameter
#==, from_h, #initialize, #inspect, #to_h, #to_s, #to_xml
Constructor Details
This class inherits a constructor from Parameter
Class Method Details
.from_xml_element(geocode_xml_element) ⇒ Object
:nodoc:
15 16 17 18 |
# File 'lib/generators/rcap/models/templates/models/geocode.rb', line 15 def self.from_xml_element( geocode_xml_element ) # :nodoc: self.new( :name => RCAP.xpath_text( geocode_xml_element, NAME_XPATH ), :value => RCAP.xpath_text( geocode_xml_element, VALUE_XPATH )) end |
Instance Method Details
#to_xml_element ⇒ Object
:nodoc:
8 9 10 11 12 13 |
# File 'lib/generators/rcap/models/templates/models/geocode.rb', line 8 def to_xml_element # :nodoc: xml_element = REXML::Element.new( XML_ELEMENT_NAME ) xml_element.add_element( NAME_ELEMENT_NAME ).add_text( @name ) xml_element.add_element( VALUE_ELEMENT_NAME ).add_text( @value ) xml_element end |