Class: ONIX::IntegerType
- Inherits:
-
ROXML::XMLRef
- Object
- ROXML::XMLRef
- ONIX::IntegerType
- Defined in:
- lib/onix/integer_type.rb
Overview
- ::nodoc
Instance Attribute Summary collapse
-
#cdata ⇒ Object
readonly
Returns the value of attribute cdata.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(accessor, args, &block) ⇒ IntegerType
constructor
A new instance of IntegerType.
-
#update_xml(xml, value) ⇒ Object
Updates the text in the given xml block to the value provided.
- #value(xml) ⇒ Object
Constructor Details
#initialize(accessor, args, &block) ⇒ IntegerType
Returns a new instance of IntegerType.
7 8 9 10 11 |
# File 'lib/onix/integer_type.rb', line 7 def initialize(accessor, args, &block) super(accessor, args, &block) @content = args.content? @cdata = args.cdata? end |
Instance Attribute Details
#cdata ⇒ Object (readonly)
Returns the value of attribute cdata.
5 6 7 |
# File 'lib/onix/integer_type.rb', line 5 def cdata @cdata end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/onix/integer_type.rb', line 5 def content @content end |
Instance Method Details
#update_xml(xml, value) ⇒ Object
Updates the text in the given xml block to the value provided.
15 16 17 18 19 |
# File 'lib/onix/integer_type.rb', line 15 def update_xml(xml, value) parent = wrap(xml) add(parent.child_add(LibXML::XML::Node.new_element(name)), value) xml end |
#value(xml) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/onix/integer_type.rb', line 21 def value(xml) if content value = xml.content.to_i else child = xml.search(name).first value = child.content.to_i if child end block ? block.call(value) : value end |