lib/watir-webdriver/attribute_helper.rb in watir-webdriver-0.2.1 vs lib/watir-webdriver/attribute_helper.rb in watir-webdriver-0.2.2
- old
+ new
@@ -50,10 +50,12 @@
define_string_attribute(method_name, attribute_name)
when :bool
define_boolean_attribute(method_name, attribute_name)
when :int
define_int_attribute(method_name, attribute_name)
+ when :float
+ define_float_attribute(method_name, attribute_name)
else
# $stderr.puts "treating #{type.inspect} as string for now"
end
end
@@ -74,9 +76,17 @@
def define_int_attribute(mname, aname)
define_method mname do
assert_exists
value = @element.attribute(aname)
value && Integer(value)
+ end
+ end
+
+ def define_float_attribute(mname, aname)
+ define_method mname do
+ assert_exists
+ value = @element.attribute(aname)
+ value && Float(value)
end
end
def add_attributes(attributes)
attributes.each do |type, attr_list|