File: frame.rb

package info (click to toggle)
ruby-mechanize 2.7.6-1%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,480 kB
  • sloc: ruby: 11,380; makefile: 5; sh: 4
file content (29 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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.

class Mechanize::Page::Frame < Mechanize::Page::Link

  alias :src :href

  attr_reader :text
  alias :name :text

  attr_reader :node

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

end