Module: Cut::ClassMethods
- Defined in:
- lib/cut/class_methods.rb
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
- #first(options = {}) ⇒ Object
- #map(*args) ⇒ Object
- #selector(new_selector) ⇒ Object
- #url(new_url) ⇒ Object
Instance Method Details
#all(options = {}) ⇒ Object
16 17 18 |
# File 'lib/cut/class_methods.rb', line 16 def all( = {}) Client.get(@url, ).css(@selector).map {|node| from_node(node) } end |
#first(options = {}) ⇒ Object
20 21 22 |
# File 'lib/cut/class_methods.rb', line 20 def first( = {}) from_node(Client.get(@url, ).at_css(@selector)) end |
#map(*args) ⇒ Object
12 13 14 |
# File 'lib/cut/class_methods.rb', line 12 def map(*args) add_mapping(*args) end |
#selector(new_selector) ⇒ Object
8 9 10 |
# File 'lib/cut/class_methods.rb', line 8 def selector(new_selector) @selector = new_selector end |
#url(new_url) ⇒ Object
4 5 6 |
# File 'lib/cut/class_methods.rb', line 4 def url(new_url) @url = new_url end |