Class: Itonoko::XML::Attr

Inherits:
Object
  • Object
show all
Defined in:
lib/itonoko/xml/attr.rb

Constant Summary collapse

ATTRIBUTE_NODE =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, document = nil) ⇒ Attr

Returns a new instance of Attr.



10
11
12
13
14
# File 'lib/itonoko/xml/attr.rb', line 10

def initialize(name, value, document = nil)
  @name     = name
  @value    = value
  @document = document
end

Instance Attribute Details

#documentObject

Returns the value of attribute document.



6
7
8
# File 'lib/itonoko/xml/attr.rb', line 6

def document
  @document
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/itonoko/xml/attr.rb', line 6

def name
  @name
end

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/itonoko/xml/attr.rb', line 6

def value
  @value
end

Instance Method Details

#inspectObject



28
29
30
# File 'lib/itonoko/xml/attr.rb', line 28

def inspect
  "#<#{self.class} name=#{name.inspect} value=#{value.inspect}>"
end

#node_nameObject



16
17
18
# File 'lib/itonoko/xml/attr.rb', line 16

def node_name
  @name
end

#node_typeObject



20
21
22
# File 'lib/itonoko/xml/attr.rb', line 20

def node_type
  ATTRIBUTE_NODE
end

#to_sObject



24
25
26
# File 'lib/itonoko/xml/attr.rb', line 24

def to_s
  value.to_s
end