Class: RDF::RDFa::Reader::REXML::NodeSetProxy

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/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



176
177
178
179
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/reader/rexml.rb', line 176

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



199
200
201
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/reader/rexml.rb', line 199

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

Instance Attribute Details

#node_setObject (readonly)

Returns the value of attribute node_set



173
174
175
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/reader/rexml.rb', line 173

def node_set
  @node_set
end

#parentObject (readonly)

Returns the value of attribute parent



174
175
176
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/reader/rexml.rb', line 174

def parent
  @parent
end

Instance Method Details

#each {|| ... } ⇒ Object

Return a proxy for each child

Yields:

  • child

Yield Parameters:



186
187
188
189
190
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/reader/rexml.rb', line 186

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

#to_htmlObject



193
194
195
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/reader/rexml.rb', line 193

def to_html
  node_set.map(&:to_s).join("")
end