mechanize 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mechanize might be problematic. Click here for more details.

Files changed (2) hide show
  1. data/lib/mechanize.rb +21 -1
  2. metadata +2 -2
data/lib/mechanize.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # set cookies (I might be wrong), does not automatically redirect and has
7
7
  # problems with some html documents.
8
8
 
9
- Version = "0.1.3"
9
+ Version = "0.2.0"
10
10
 
11
11
  # required due to the missing get_fields method in Ruby 1.8.2
12
12
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "mechanize", "net-overrides")
@@ -73,6 +73,24 @@ class Button
73
73
  end
74
74
  end
75
75
 
76
+ class SelectList
77
+ attr_accessor :name, :value, :options
78
+
79
+ def initialize(name, node)
80
+ @name = name
81
+ @options = []
82
+
83
+ # parse
84
+ node.each_recursive {|n|
85
+ if n.name.downcase == 'option'
86
+ value = n.attributes['value']
87
+ @options << value
88
+ @value = value if n.attributes['selected']
89
+ end
90
+ }
91
+ end
92
+ end
93
+
76
94
  # Class Form does not work in the case there is some invalid (unbalanced) html
77
95
  # involved, such as:
78
96
  #
@@ -120,6 +138,8 @@ class GlobalForm
120
138
  when 'submit'
121
139
  @buttons << Button.new(node.attributes['name'], node.attributes['value'])
122
140
  end
141
+ when 'select'
142
+ @fields << SelectList.new(node.attributes['name'], node)
123
143
  end
124
144
  }
125
145
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.6
3
3
  specification_version: 1
4
4
  name: mechanize
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.3
7
- date: 2005-04-01
6
+ version: 0.2.0
7
+ date: 2005-04-05
8
8
  summary: Automated web-browsing.
9
9
  require_paths:
10
10
  - lib