Class: XmlParsable::Elements::StringElement
- Inherits:
-
AbstractElement
- Object
- AbstractElement
- XmlParsable::Elements::StringElement
- Defined in:
- lib/xmlparsable/elements/string.rb
Overview
Parses content into a ruby String value. This discards comments and children elements so “abc <!– foo –> def whatever” is read as “abc def”
Defined Under Namespace
Classes: String
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize(name, attributes, parent, arguments) ⇒ StringElement
constructor
A new instance of StringElement.
- #read(text) ⇒ Object
Methods inherited from AbstractElement
Constructor Details
#initialize(name, attributes, parent, arguments) ⇒ StringElement
Returns a new instance of StringElement.
15 16 17 18 |
# File 'lib/xmlparsable/elements/string.rb', line 15 def initialize(name, attributes, parent, arguments) @name, @attributes, @parent, @string = name, attributes, parent, String.new end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/xmlparsable/elements/string.rb', line 13 def name @name end |
Instance Method Details
#finalize ⇒ Object
24 25 26 27 |
# File 'lib/xmlparsable/elements/string.rb', line 24 def finalize @string.instance_variable_set(:@xmlattrs, @attributes) @parent.close(self, @string) end |
#read(text) ⇒ Object
20 21 22 |
# File 'lib/xmlparsable/elements/string.rb', line 20 def read(text) @string << text end |