Class: Cut::Node
- Inherits:
-
Object
- Object
- Cut::Node
- Defined in:
- lib/cut/node.rb
Direct Known Subclasses
Instance Method Summary collapse
- #at_css(selector) ⇒ Object
- #css(selector) ⇒ Object
-
#initialize(node) ⇒ Node
constructor
A new instance of Node.
- #value ⇒ Object
Constructor Details
#initialize(node) ⇒ Node
Returns a new instance of Node.
4 5 6 |
# File 'lib/cut/node.rb', line 4 def initialize(node) @node = node end |
Instance Method Details
#at_css(selector) ⇒ Object
12 13 14 |
# File 'lib/cut/node.rb', line 12 def at_css(selector) Node.new(node.at_css(selector)) end |
#css(selector) ⇒ Object
8 9 10 |
# File 'lib/cut/node.rb', line 8 def css(selector) node.css(selector).map {|n| Node.new(n) } end |
#value ⇒ Object
16 17 18 |
# File 'lib/cut/node.rb', line 16 def value node.try(:text) end |