Class: SaxStream::Internal::ElementStack::Element
- Inherits:
-
Object
- Object
- SaxStream::Internal::ElementStack::Element
- Defined in:
- lib/sax_stream/internal/element_stack.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #attributes(prefix = nil) ⇒ Object
- #content ⇒ Object
-
#initialize(name, attrs) ⇒ Element
constructor
A new instance of Element.
- #record_characters(string) ⇒ Object
- #relative_attributes ⇒ Object
Constructor Details
#initialize(name, attrs) ⇒ Element
Returns a new instance of Element.
9 10 11 12 13 |
# File 'lib/sax_stream/internal/element_stack.rb', line 9 def initialize(name, attrs) @name = name @attrs = attrs @content = nil end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/sax_stream/internal/element_stack.rb', line 7 def name @name end |
Instance Method Details
#attributes(prefix = nil) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/sax_stream/internal/element_stack.rb', line 15 def attributes(prefix = nil) prefix ||= @name @attrs.map do |key, value| ["#{prefix}/@#{key}", value] end end |
#content ⇒ Object
26 27 28 |
# File 'lib/sax_stream/internal/element_stack.rb', line 26 def content @content end |
#record_characters(string) ⇒ Object
30 31 32 33 |
# File 'lib/sax_stream/internal/element_stack.rb', line 30 def record_characters(string) @content ||= '' @content += string end |
#relative_attributes ⇒ Object
22 23 24 |
# File 'lib/sax_stream/internal/element_stack.rb', line 22 def relative_attributes @attrs end |