Class: Mohawk::Accessors::Table
- Inherits:
-
Object
- Object
- Mohawk::Accessors::Table
- Includes:
- Enumerable
- Defined in:
- lib/mohawk/accessors/table.rb
Instance Attribute Summary collapse
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
- #[](row) ⇒ Object
- #add(which_item) ⇒ Object
- #clear(which_item) ⇒ Object
- #clear_all ⇒ Object
- #each ⇒ Object
- #find_row_with(row_info) ⇒ Object
- #headers ⇒ Object
-
#initialize(adapter, locator) ⇒ Table
constructor
A new instance of Table.
- #select(which_item) ⇒ Object
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
#view ⇒ Object (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
45 46 47 |
# File 'lib/mohawk/accessors/table.rb', line 45 def [](row) TableRow.new(self, row) end |
#add(which_item) ⇒ Object
16 17 18 |
# File 'lib/mohawk/accessors/table.rb', line 16 def add(which_item) find_row_with(which_item).add_to_selection end |
#clear(which_item) ⇒ Object
24 25 26 |
# File 'lib/mohawk/accessors/table.rb', line 24 def clear(which_item) find_row_with(which_item).clear end |
#clear_all ⇒ Object
20 21 22 |
# File 'lib/mohawk/accessors/table.rb', line 20 def clear_all view.selected_rows.each(&:clear) end |
#each ⇒ Object
49 50 51 52 53 |
# File 'lib/mohawk/accessors/table.rb', line 49 def each view.row_count.times.map do |row| yield TableRow.new(self, row) end end |
#find_row_with(row_info) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mohawk/accessors/table.rb', line 28 def find_row_with(row_info) found_row = case row_info when Hash find_by_hash(row_info) when Fixnum find_by_index(row_info) when String find_by_value(row_info) end raise "A row with #{row_info} was not found" unless found_row found_row end |
#headers ⇒ Object
41 42 43 |
# File 'lib/mohawk/accessors/table.rb', line 41 def headers RAutomation::Adapter::MsUia::UiaDll.table_headers(view.search_information) end |
#select(which_item) ⇒ Object
12 13 14 |
# File 'lib/mohawk/accessors/table.rb', line 12 def select(which_item) find_row_with(which_item).select end |