Class: Mache::Node Abstract
Overview
Direct Known Subclasses
Instance Attribute Summary collapse
-
#node ⇒ Capybara::Node
readonly
The underlying Capybara node object wrapped by this instance.
Instance Method Summary collapse
-
#empty? ⇒ Boolean
Tests whether the node is empty.
-
#initialize(node:) ⇒ Node
constructor
Returns a new instance of Node.
- #method_missing(name, *args, **kwargs, &block) ⇒ Object
Methods included from DSL
Constructor Details
#initialize(node:) ⇒ Node
Returns a new instance of Node.
20 21 22 |
# File 'lib/mache/node.rb', line 20 def initialize(node:) @node = node end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/mache/node.rb', line 33 def method_missing(name, *args, &block) if @node.respond_to?(name) @node.send(name, *args, &block) else super end end |
Instance Attribute Details
#node ⇒ Capybara::Node (readonly)
The underlying Capybara node object wrapped by this instance.
15 16 17 |
# File 'lib/mache/node.rb', line 15 def node @node end |
Instance Method Details
#empty? ⇒ Boolean
Tests whether the node is empty.
27 28 29 |
# File 'lib/mache/node.rb', line 27 def empty? node.all('*').length.zero? end |