Class: Mohawk::Accessors::Tabs

Inherits:
Object
  • Object
show all
Defined in:
lib/mohawk/accessors/tabs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter, locator) ⇒ Tabs

Returns a new instance of Tabs.



6
7
8
# File 'lib/mohawk/accessors/tabs.rb', line 6

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

Instance Attribute Details

#viewObject (readonly)

Returns the value of attribute view.



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

def view
  @view
end

Instance Method Details

#itemsObject



25
26
27
# File 'lib/mohawk/accessors/tabs.rb', line 25

def items
  @view.items.map(&:text)
end

#selected_tab=(which) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/mohawk/accessors/tabs.rb', line 14

def selected_tab=(which)
  case which
    when String
      view.set(which)
    when Regexp
      view.set items.find {|t| t.match which }
    else
      view.select(which)
  end
end

#valueObject



10
11
12
# File 'lib/mohawk/accessors/tabs.rb', line 10

def value
  view.value
end