Sha256: 9c7f9780f4e107816ae1db9631461e9a9a618f0a8ce982dc339447049350cc9c

Contents?: true

Size: 350 Bytes

Versions: 17

Compression:

Stored size: 350 Bytes

Contents

# frozen_string_literal: true
##
# A form label on an HTML page

class Mechanize::Page::Label
  attr_reader :node
  attr_reader :text
  attr_reader :page
  alias :to_s :text

  def initialize(node, page)
    @node = node
    @text = node.inner_text
    @page = page
  end

  def for
    (id = @node['for']) && page.search("##{id}") || nil
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mechanize-2.14.0 lib/mechanize/page/label.rb
mechanize-2.13.0 lib/mechanize/page/label.rb
mechanize-2.12.2 lib/mechanize/page/label.rb
mechanize-2.12.1 lib/mechanize/page/label.rb
mechanize-2.12.0 lib/mechanize/page/label.rb
mechanize-2.11.0 lib/mechanize/page/label.rb
mechanize-2.10.1 lib/mechanize/page/label.rb
mechanize-2.10.0 lib/mechanize/page/label.rb
mechanize-2.9.2 lib/mechanize/page/label.rb
mechanize-2.9.1 lib/mechanize/page/label.rb
mechanize-2.9.0 lib/mechanize/page/label.rb
mechanize-2.8.5 lib/mechanize/page/label.rb
mechanize-2.8.4 lib/mechanize/page/label.rb
mechanize-2.8.3 lib/mechanize/page/label.rb
mechanize-2.8.2 lib/mechanize/page/label.rb
mechanize-2.8.1 lib/mechanize/page/label.rb
mechanize-2.8.0 lib/mechanize/page/label.rb