Class: JSON::LD::API::REXML::NodeSetProxy
- Inherits:
-
Object
- Object
- JSON::LD::API::REXML::NodeSetProxy
- Defined in:
- lib/json/ld/html/rexml.rb
Overview
NodeSet proxy
Instance Attribute Summary collapse
-
#node_set ⇒ Object
readonly
Returns the value of attribute node_set.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#each {|| ... } ⇒ Object
Return a proxy for each child.
-
#initialize(node_set, parent) ⇒ NodeSetProxy
constructor
A new instance of NodeSetProxy.
-
#method_missing(method, *args) ⇒ Object
Proxy for everything else to @node_set.
- #to_html ⇒ Object
Constructor Details
#initialize(node_set, parent) ⇒ NodeSetProxy
Returns a new instance of NodeSetProxy.
142 143 144 145 |
# File 'lib/json/ld/html/rexml.rb', line 142 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
165 166 167 |
# File 'lib/json/ld/html/rexml.rb', line 165 def method_missing(method, *args) @node_set.send(method, *args) end |
Instance Attribute Details
#node_set ⇒ Object (readonly)
Returns the value of attribute node_set.
140 141 142 |
# File 'lib/json/ld/html/rexml.rb', line 140 def node_set @node_set end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
140 141 142 |
# File 'lib/json/ld/html/rexml.rb', line 140 def parent @parent end |
Instance Method Details
#each {|| ... } ⇒ Object
Return a proxy for each child
152 153 154 155 156 |
# File 'lib/json/ld/html/rexml.rb', line 152 def each @node_set.each do |c| yield NodeProxy.new(c, parent) end end |
#to_html ⇒ Object
159 160 161 |
# File 'lib/json/ld/html/rexml.rb', line 159 def to_html node_set.map(&:to_s).join end |