Class: Mechanize::Page::Frame

Inherits:
Link
  • Object
show all
Defined in:
lib/mechanize/page/frame.rb

Overview

This class encapsulates a ‘frame’ tag. Frame objects can be treated just like Link objects. They contain #src, the #link they refer to and a #name, the name of the frame they refer to. #src and #name are aliased to #href and #text respectively so that a Frame object can be treated just like a Link.

Instance Attribute Summary collapse

Attributes inherited from Link

#attributes, #href, #node, #page

Instance Method Summary collapse

Methods inherited from Link

#click, #dom_id, #pretty_print, #rel, #rel?, #uri

Constructor Details

#initialize(node, mech, referer) ⇒ Frame

Returns a new instance of Frame.



14
15
16
17
18
19
20
# File 'lib/mechanize/page/frame.rb', line 14

def initialize(node, mech, referer)
  super(node, mech, referer)
  @node = node
  @text = node['name']
  @href = node['src']
  @content = nil
end

Instance Attribute Details

#textObject (readonly) Also known as: name

Returns the value of attribute text.



11
12
13
# File 'lib/mechanize/page/frame.rb', line 11

def text
  @text
end

Instance Method Details

#contentObject



22
23
24
# File 'lib/mechanize/page/frame.rb', line 22

def content
  @content ||= @mech.get @href, [], page
end