Sha256: 1396a6b94f30a962baba8c59c6cd8dac0b1692feca4cba10473aa46d076a4786

Contents?: true

Size: 730 Bytes

Versions: 9

Compression:

Stored size: 730 Bytes

Contents

module WWW
  class Mechanize
    class Form
      # This class represents a field in a form.  It handles the following input
      # tags found in a form:
      # text, password, hidden, int, textarea
      #
      # To set the value of a field, just use the value method:
      # field.value = "foo"
      class Field
        attr_accessor :name, :value
      
        def initialize(name, value)
          @name = Mechanize.html_unescape(name)
          @value = if value.is_a? String
                     Mechanize.html_unescape(value)
                   else
                     value
                   end
        end
      
        def query_value
          [[@name, @value || '']]
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mechanize-0.7.8 lib/www/mechanize/form/field.rb
mechanize-0.7.1 lib/www/mechanize/form/field.rb
mechanize-0.7.5 lib/www/mechanize/form/field.rb
mechanize-0.7.2 lib/www/mechanize/form/field.rb
mechanize-0.7.0 lib/www/mechanize/form/field.rb
mechanize-0.7.3 lib/www/mechanize/form/field.rb
mechanize-0.7.4 lib/www/mechanize/form/field.rb
mechanize-0.7.6 lib/www/mechanize/form/field.rb
mechanize-0.7.7 lib/www/mechanize/form/field.rb