Class: REXML::Parent

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

Instance Method Summary collapse

Instance Method Details

#each_on_axis(axis, &block) ⇒ Object



142
143
144
# File 'lib/xml/rexml_ext.rb', line 142

def each_on_axis(axis, &block)
  send :"each_on_axis_#{axis}", &block
end

#each_on_axis_childObject



118
119
120
121
122
123
124
125
126
127
# File 'lib/xml/rexml_ext.rb', line 118

def each_on_axis_child
  if respond_to? :attributes
    attributes.each_key do |name|
      yield XML::XXPath::Accessors::Attribute.new(self, name, false)
    end
  end
  each_child do |c|
    yield c
  end
end

#each_on_axis_descendant(&block) ⇒ Object



129
130
131
132
133
134
135
136
# File 'lib/xml/rexml_ext.rb', line 129

def each_on_axis_descendant(&block)
  each_on_axis_child do |c|
    block.call c
    if REXML::Parent===c
      c.each_on_axis_descendant(&block)
    end
  end
end

#each_on_axis_self {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (REXML::Parent)

    the object that the method was called on



138
139
140
# File 'lib/xml/rexml_ext.rb', line 138

def each_on_axis_self
  yield self
end