Class: RDF::RDFXML::Reader::REXML::NodeSetProxy

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



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

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



266
267
268
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 266

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

Instance Attribute Details

#node_setObject (readonly)

Returns the value of attribute node_set.



233
234
235
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 233

def node_set
  @node_set
end

#parentObject (readonly)

Returns the value of attribute parent.



234
235
236
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 234

def parent
  @parent
end

Instance Method Details

#each {|| ... } ⇒ Object

Return a proxy for each child

Yields:

  • child

Yield Parameters:



246
247
248
249
250
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 246

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

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

Return selected NodeProxies based on selection

Yields:

  • child

Yield Parameters:

Returns:



258
259
260
261
262
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 258

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