class RDF::Microdata::Reader::Nokogiri::NodeSetProxy

NodeSet proxy

Attributes

node_set[R]
parent[R]

Public Class Methods

new(node_set, parent) click to toggle source
# File lib/rdf/microdata/reader/nokogiri.rb, line 125
def initialize(node_set, parent)
  @node_set = node_set
  @parent = parent
end

Public Instance Methods

+(other) click to toggle source

Add NodeSetProxys @param [NodeSetProxy, Nokogiri::XML::Node] other @return [NodeSetProxy]

# File lib/rdf/microdata/reader/nokogiri.rb, line 152
def +(other)
  NodeSetProxy.new(self.node_set + other.node_set, parent)
end
<<(elem) click to toggle source

Add a NodeProxy @param [NodeProxy, Nokogiri::XML::Node] elem @return [NodeSetProxy]

# File lib/rdf/microdata/reader/nokogiri.rb, line 160
def <<(elem)
  node_set << (elem.is_a?(NodeProxy) ? elem.node : elem)
  self
end
each() { |node_proxy| ... } click to toggle source

Return a proxy for each child

@yield child @yieldparam [NodeProxy] child

# File lib/rdf/microdata/reader/nokogiri.rb, line 135
def each
  @node_set.each do |c|
    yield NodeProxy.new(c, parent)
  end
end
inspect() click to toggle source
# File lib/rdf/microdata/reader/nokogiri.rb, line 165
def inspect
  @node_set.map {|c| NodeProxy.new(c, parent).display_path}.inspect
end
method_missing(method, *args) click to toggle source

Proxy for everything else to @node_set

# File lib/rdf/microdata/reader/nokogiri.rb, line 171
def method_missing(method, *args)
  @node_set.send(method, *args)
end
shift() click to toggle source

Return proxy for first element and remove it @return [NodeProxy]

# File lib/rdf/microdata/reader/nokogiri.rb, line 144
def shift
  (e = node_set.shift) && NodeProxy.new(e, parent)
end