Class: Mohawk::Accessors::Table

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/mohawk/accessors/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter, locator) ⇒ Table

Returns a new instance of Table.



8
9
10
# File 'lib/mohawk/accessors/table.rb', line 8

def initialize(adapter, locator)
  @view = adapter.window.table(locator)
end

Instance Attribute Details

#viewObject (readonly)

Returns the value of attribute view.



4
5
6
# File 'lib/mohawk/accessors/table.rb', line 4

def view
  @view
end

Instance Method Details

#[](row) ⇒ Object



31
32
33
# File 'lib/mohawk/accessors/table.rb', line 31

def [](row)
  TableRow.new(self, row)
end

#eachObject



35
36
37
38
39
# File 'lib/mohawk/accessors/table.rb', line 35

def each
  view.row_count.times.map do |row|
    yield TableRow.new(self, row)
  end
end

#find_row_with(row_info) ⇒ Object



21
22
23
24
25
# File 'lib/mohawk/accessors/table.rb', line 21

def find_row_with(row_info)
  found_row = find { |r| r.all_match? row_info }
  raise "A row with #{row_info} was not found" unless found_row
  found_row
end

#headersObject



27
28
29
# File 'lib/mohawk/accessors/table.rb', line 27

def headers
  RAutomation::Adapter::MsUia::UiaDll.table_headers(view.search_information)
end

#select(which_item) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/mohawk/accessors/table.rb', line 12

def select(which_item)
  case which_item
    when Hash
      select_by_hash(which_item)
    else
      select_by_value(which_item)
  end
end