Class: Mechanize::Page::Image
- Inherits:
-
Object
- Object
- Mechanize::Page::Image
- Defined in:
- lib/mechanize/page/image.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(node, page) ⇒ Image
constructor
A new instance of Image.
- #src ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(node, page) ⇒ Image
Returns a new instance of Image.
7 8 9 10 |
# File 'lib/mechanize/page/image.rb', line 7 def initialize(node, page) @node = node @page = page end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/mechanize/page/image.rb', line 4 def node @node end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
5 6 7 |
# File 'lib/mechanize/page/image.rb', line 5 def page @page end |
Instance Method Details
#src ⇒ Object
12 13 14 |
# File 'lib/mechanize/page/image.rb', line 12 def src @node['src'] end |
#url ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mechanize/page/image.rb', line 16 def url case src when %r{^https?://} src else if page.bases[0] (page.bases[0].href + src).to_s else (page.uri + src).to_s end end end |