class XTJ::Tags::XMLTag

Attributes

attributes[R]
tag[R]

Public Class Methods

new(tag:, attributes:) click to toggle source
# File lib/xtj/tags/xml_tag.rb, line 11
def initialize(tag:, attributes:)
  @tag = tag
  @attributes = attributes
end

Public Instance Methods

add_to_attributes(tag, attributes) click to toggle source
# 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
    same_tags = [@attributes[tag]]
    @attributes[tag] = same_tags << attributes
  end
end