Class: SDL4R::Element

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#attributesObject (readonly)

Returns the value of attribute attributes.



27
28
29
# File 'lib/sdl4r/element.rb', line 27

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/sdl4r/element.rb', line 27

def name
  @name
end

#prefixObject (readonly)

Returns the value of attribute prefix.



27
28
29
# File 'lib/sdl4r/element.rb', line 27

def prefix
  @prefix
end

#self_closingObject

Returns the value of attribute self_closing.



26
27
28
# File 'lib/sdl4r/element.rb', line 26

def self_closing
  @self_closing
end

#valuesObject (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