Class: XTJ::Tags::XMLTag
- Inherits:
-
Object
- Object
- XTJ::Tags::XMLTag
- Extended by:
- T::Sig
- Defined in:
- lib/xtj/tags/xml_tag.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #add_to_attributes(tag, attributes) ⇒ Object
-
#initialize(tag:, attributes:) ⇒ XMLTag
constructor
A new instance of XMLTag.
Constructor Details
#initialize(tag:, attributes:) ⇒ XMLTag
Returns a new instance of XMLTag.
11 12 13 14 |
# File 'lib/xtj/tags/xml_tag.rb', line 11 def initialize(tag:, attributes:) @tag = tag @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
8 9 10 |
# File 'lib/xtj/tags/xml_tag.rb', line 8 def attributes @attributes end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
8 9 10 |
# File 'lib/xtj/tags/xml_tag.rb', line 8 def tag @tag end |
Instance Method Details
#add_to_attributes(tag, attributes) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/xtj/tags/xml_tag.rb', line 17 def add_to_attributes(tag, attributes) if @attributes[tag].nil? @attributes[tag] = attributes elsif @attributes[tag].is_a?(Array) @attributes[tag] << attributes else = [@attributes[tag]] @attributes[tag] = << attributes end end |