Class: RDF::RDFXML::Reader::Nokogiri::NodeSetProxy

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/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.



214
215
216
217
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/nokogiri.rb', line 214

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



244
245
246
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/nokogiri.rb', line 244

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

Instance Attribute Details

#node_setObject (readonly)

Returns the value of attribute node_set.



211
212
213
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/nokogiri.rb', line 211

def node_set
  @node_set
end

#parentObject (readonly)

Returns the value of attribute parent.



212
213
214
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/nokogiri.rb', line 212

def parent
  @parent
end

Instance Method Details

#each {|| ... } ⇒ Object

Return a proxy for each child

Yields:

  • child

Yield Parameters:



224
225
226
227
228
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/nokogiri.rb', line 224

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

#select {|| ... } ⇒ Array[NodeProxy]

Return selected NodeProxies based on selection

Yields:

  • child

Yield Parameters:

Returns:



236
237
238
239
240
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/nokogiri.rb', line 236

def select
  @node_set.to_a.map {|n| NodeProxy.new(n, parent)}.select do |c|
    yield c
  end
end