class Mohawk::Adapters::UIA::TableRow
Attributes
index[R]
Public Class Methods
new(table, index)
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 7 def initialize(table, index) @table, @index = table, index end
Public Instance Methods
add()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 24 def add selection_item.add_to_selection self end
all_match?(hash)
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 38 def all_match?(hash) hash.all? do |key, value| value_from_header(key) == "#{value}" end end
cells()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 15 def cells element.items.map &:name end
clear()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 29 def clear selection_item.remove_from_selection self end
method_missing(name, *args)
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 48 def method_missing(name, *args) value_from_header name end
name()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 11 def name element.name end
select()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 19 def select selection_item.select self end
selected?()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 34 def selected? selection_item.selected? end
to_hash()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 44 def to_hash {text: element.name, row: index} end
value_from_header(name)
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 52 def value_from_header(name) which_column = header_methods.find_index {|h| h.to_s == name.to_s } raise ArgumentError, "#{name} column does not exist in #{header_methods}" if which_column.nil? cells[which_column] end
Private Instance Methods
element()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 59 def element @element ||= @table.element.row_at(@index) end
header_methods()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 67 def header_methods @headers ||= @table.headers.map(&:to_method) end
selection_item()
click to toggle source
# File lib/mohawk/adapters/uia/table_row.rb, line 63 def selection_item element.as :selection_item end