Class: Wagon::Page
- Inherits:
-
Object
show all
- Defined in:
- lib/wagon/page.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(connection, url, parent = nil) ⇒ Page
Returns a new instance of Page.
7
8
9
|
# File 'lib/wagon/page.rb', line 7
def initialize(connection, url, parent = nil)
@connection, @url, @parent = connection, url, parent
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/wagon/page.rb', line 23
def method_missing(method, *args, &block)
unless source.respond_to?(method)
super(method, *args, &block)
else
source.send(method, *args, &block)
end
end
|
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
5
6
7
|
# File 'lib/wagon/page.rb', line 5
def connection
@connection
end
|
Instance Method Details
#get(*args) ⇒ Object
15
16
17
|
# File 'lib/wagon/page.rb', line 15
def get(*args)
connection.get(*args)
end
|
#post(*args) ⇒ Object
19
20
21
|
# File 'lib/wagon/page.rb', line 19
def post(*args)
connection.post(*args)
end
|
#source ⇒ Object
11
12
13
|
# File 'lib/wagon/page.rb', line 11
def source
@source ||= Nokogiri::HTML(get(@url))
end
|