Class: RCAP::EventCode

Inherits:
Parameter
  • Object
show all
Defined in:
lib/generators/rcap/models/templates/models/event_code.rb

Constant Summary collapse

XML_ELEMENT_NAME =

:nodoc:

'eventCode'
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

#name, #value

Class Method Summary collapse

Instance Method Summary collapse

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(event_code_xml_element) ⇒ Object

:nodoc:



15
16
17
18
# File 'lib/generators/rcap/models/templates/models/event_code.rb', line 15

def self.from_xml_element( event_code_xml_element ) # :nodoc:
	EventCode.new( :name  => RCAP.xpath_text( event_code_xml_element, NAME_XPATH ),
								 :value => RCAP.xpath_text( event_code_xml_element, VALUE_XPATH ))
end

Instance Method Details

#to_xml_elementObject

:nodoc:



8
9
10
11
12
13
# File 'lib/generators/rcap/models/templates/models/event_code.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( self.name )
  xml_element.add_element( VALUE_ELEMENT_NAME ).add_text( self.value )
  xml_element
end