Class: WatirCraft::Row

Inherits:
Object show all
Defined in:
lib/watircraft/table.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(watir_row) ⇒ Row

Returns a new instance of Row.



63
64
65
# File 'lib/watircraft/table.rb', line 63

def initialize watir_row
  @row = watir_row
end

Instance Attribute Details

#rowObject (readonly)

Returns the value of attribute row.



62
63
64
# File 'lib/watircraft/table.rb', line 62

def row
  @row
end

Class Method Details

.element(name, &block) ⇒ Object



38
39
40
41
42
43
# File 'lib/watircraft/table.rb', line 38

def element name, &block
  elements << name
  define_method(name) do
    instance_eval &block
  end
end

.elementsObject

:nodoc:



44
45
46
# File 'lib/watircraft/table.rb', line 44

def elements # :nodoc:
  @elements ||= []
end

.field(name, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/watircraft/table.rb', line 47

def field name, &block
  fields << name
  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

.fieldsObject

:nodoc:



58
59
60
# File 'lib/watircraft/table.rb', line 58

def fields # :nodoc:
  @fields ||= []
end

Instance Method Details

#exist?Boolean

Returns true. If the row doesn’t exist, you’ll get nil as the return value of Table#row.

Returns:

  • (Boolean)


68
69
70
# File 'lib/watircraft/table.rb', line 68

def exist?
  true
end