Class: RAutomation::Adapter::MsUia::Row

Inherits:
Object
  • Object
show all
Includes:
Locators
Defined in:
lib/rautomation/adapter/ms_uia/table.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(window, locators) ⇒ Row

Returns a new instance of Row.



44
45
46
47
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 44

def initialize(window, locators)
  @hwnd = window.hwnd
  @locators = extract(locators)
end

Instance Attribute Details

#hwnd (readonly)

Returns the value of attribute hwnd.



30
31
32
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 30

def hwnd
  @hwnd
end

Class Method Details

.locators_match?(locators, item) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
65
66
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 61

def self.locators_match?(locators, item)
  locators.all? do |locator, value|
    return item.value =~ value if value.is_a? Regexp
    return item.send(locator) == value
  end
end

Instance Method Details

#cell(locators = {})



40
41
42
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 40

def cell(locators={})
  cells(locators).first
end

#cells(locators = {})



34
35
36
37
38
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 34

def cells(locators={})
  Cells.new(self, locators).select do |cell|
    Row.locators_match? locators, cell
  end
end

#exists?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 57

def exists?
  UiaDll::table_coordinate_valid?(@hwnd, @locators[:index])
end

#index Also known as: row



49
50
51
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 49

def index
  @locators[:index] || 0
end

#value Also known as: text



53
54
55
# File 'lib/rautomation/adapter/ms_uia/table.rb', line 53

def value
  UiaDll::table_value_at @hwnd, @locators[:index]
end