Class: SDL4R::Element
- Inherits:
-
Object
- Object
- SDL4R::Element
- Defined in:
- lib/sdl4r/element.rb
Overview
Used internally by Reader for keeping track of its state. It shouldn’t be used directly as it is subject to changes as Reader is modified.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#self_closing ⇒ Object
Returns the value of attribute self_closing.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #add_attribute(prefix, name, value) ⇒ Object
- #add_value(value) ⇒ Object
-
#initialize(prefix, name) ⇒ Element
constructor
A new instance of Element.
Constructor Details
#initialize(prefix, name) ⇒ Element
Returns a new instance of Element.
29 30 31 32 33 34 35 |
# File 'lib/sdl4r/element.rb', line 29 def initialize(prefix, name) @prefix = prefix @name = name @attributes = [] @values = [] @self_closing = false end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
27 28 29 |
# File 'lib/sdl4r/element.rb', line 27 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/sdl4r/element.rb', line 27 def name @name end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
27 28 29 |
# File 'lib/sdl4r/element.rb', line 27 def prefix @prefix end |
#self_closing ⇒ Object
Returns the value of attribute self_closing.
26 27 28 |
# File 'lib/sdl4r/element.rb', line 26 def self_closing @self_closing end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
27 28 29 |
# File 'lib/sdl4r/element.rb', line 27 def values @values end |
Instance Method Details
#add_attribute(prefix, name, value) ⇒ Object
37 38 39 |
# File 'lib/sdl4r/element.rb', line 37 def add_attribute(prefix, name, value) @attributes << [[prefix, name], value] end |
#add_value(value) ⇒ Object
41 42 43 |
# File 'lib/sdl4r/element.rb', line 41 def add_value(value) @values << value end |