Class: Moxml::Attribute
- Inherits:
-
Node
- Object
- Node
- Moxml::Attribute
show all
- Defined in:
- lib/moxml/attribute.rb
Instance Attribute Summary
Attributes inherited from Node
#native
Instance Method Summary
collapse
Methods inherited from Node
#add_next_sibling, #add_previous_sibling, #children, #column, #inner_html, #inner_html=, #line, #next_sibling, #outer_html, #parent, #path, #previous_sibling, #remove, #replace, #text, #text=, wrap
Constructor Details
#initialize(name_or_native = nil, value = nil) ⇒ Attribute
Returns a new instance of Attribute.
3
4
5
6
7
8
9
10
|
# File 'lib/moxml/attribute.rb', line 3
def initialize(name_or_native = nil, value = nil)
case name_or_native
when String
super(adapter.create_attribute(nil, name_or_native, value))
else
super(name_or_native)
end
end
|
Instance Method Details
#name ⇒ Object
12
13
14
|
# File 'lib/moxml/attribute.rb', line 12
def name
adapter.attribute_name(native)
end
|
#value ⇒ Object
16
17
18
|
# File 'lib/moxml/attribute.rb', line 16
def value
adapter.attribute_value(native)
end
|
#value=(new_value) ⇒ Object
20
21
22
|
# File 'lib/moxml/attribute.rb', line 20
def value=(new_value)
adapter.set_attribute_value(native, new_value)
end
|