lib/watircraft/table.rb in bret-watircraft-0.4.2 vs lib/watircraft/table.rb in bret-watircraft-0.4.3

- old
+ new

@@ -17,12 +17,13 @@ def row selector @watir_table.rows.each do | row | wrapped = self.class.row_class.new row # note: we are only looking at the first key/value method = selector.keys[0] - value = selector[method] - return wrapped if wrapped.send(method) == value + target_value = selector[method] + row_value = wrapped.send(method) rescue next + return wrapped if row_value == target_value end nil end end @@ -32,19 +33,20 @@ define_method(name) do instance_eval &block end end def field name, &block - element_name = "#{name}_element" + element_name = "#{name}_field" element element_name, &block define_method(name) do send(element_name).display_value end define_method("#{name}=") do | value | send(element_name).set value end end end + attr_reader :row def initialize watir_row @row = watir_row end # Returns true. If the row doesn't exist, you'll get nil as the return # value of Table#row. \ No newline at end of file