Class: Mechanize::Page::Frame

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

Overview

A Frame object wraps a frame HTML element. 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, #page

Instance Method Summary collapse

Methods inherited from Link

#click, #dom_class, #dom_id, #noreferrer?, #pretty_print, #rel, #rel?, #resolved_uri, #uri

Constructor Details

#initialize(node, mech, referer) ⇒ Frame

Returns a new instance of Frame.



17
18
19
20
21
22
23
# File 'lib/mechanize/page/frame.rb', line 17

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

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



15
16
17
# File 'lib/mechanize/page/frame.rb', line 15

def node
  @node
end

#textObject (readonly) Also known as: name

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#contentObject



25
26
27
# File 'lib/mechanize/page/frame.rb', line 25

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