Class: XMLBuilder::PathParser::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2/amitools/xmlbuilder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Attribute

Returns a new instance of Attribute.



200
201
202
# File 'lib/ec2/amitools/xmlbuilder.rb', line 200

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



198
199
200
# File 'lib/ec2/amitools/xmlbuilder.rb', line 198

def name
  @name
end

Instance Method Details

#assign_visit(rexml_node, value) ⇒ Object



209
210
211
212
# File 'lib/ec2/amitools/xmlbuilder.rb', line 209

def assign_visit(rexml_node, value)
  raise 'Can only assign an attribute to an element.' if !rexml_node.is_a?(REXML::Element)
  rexml_node.attributes[@name] = value.to_s
end

#retrieve_visit(rexml_node) ⇒ Object



214
215
216
# File 'lib/ec2/amitools/xmlbuilder.rb', line 214

def retrieve_visit(rexml_node)
  raise 'Accessor not valid for paths with an attribute'
end

#walk_visit(rexml_node) ⇒ Object

Stays on the same node in the dom



205
206
207
# File 'lib/ec2/amitools/xmlbuilder.rb', line 205

def walk_visit(rexml_node)
  rexml_node
end