Class: JSON::LD::API::Nokogiri::NodeSetProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/json/ld/html/nokogiri.rb

Overview

NodeSet proxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node_set, parent) ⇒ NodeSetProxy

Returns a new instance of NodeSetProxy.



104
105
106
107
# File 'lib/json/ld/html/nokogiri.rb', line 104

def initialize(node_set, parent)
  @node_set = node_set
  @parent = parent
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object

Proxy for everything else to @node_set



122
123
124
# File 'lib/json/ld/html/nokogiri.rb', line 122

def method_missing(method, *args)
  @node_set.send(method, *args)
end

Instance Attribute Details

#node_setObject (readonly)

Returns the value of attribute node_set.



101
102
103
# File 'lib/json/ld/html/nokogiri.rb', line 101

def node_set
  @node_set
end

#parentObject (readonly)

Returns the value of attribute parent.



102
103
104
# File 'lib/json/ld/html/nokogiri.rb', line 102

def parent
  @parent
end

Instance Method Details

#each {|| ... } ⇒ Object

Return a proxy for each child

Yields:

  • child

Yield Parameters:



114
115
116
117
118
# File 'lib/json/ld/html/nokogiri.rb', line 114

def each
  @node_set.each do |c|
    yield NodeProxy.new(c, parent)
  end
end