Class: Mohawk::Accessors::Text

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter, locator) ⇒ Text

Returns a new instance of Text.



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

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

Instance Attribute Details

#viewObject (readonly)

Returns the value of attribute view.



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

def view
  @view
end

Instance Method Details

#clearObject



19
20
21
# File 'lib/mohawk/accessors/text.rb', line 19

def clear
  @view.clear
end

#enter(text) ⇒ Object



23
24
25
26
# File 'lib/mohawk/accessors/text.rb', line 23

def enter(text)
  text_window = @adapter.window.child(:hwnd => @view.hwnd)
  text_window.send_keys text.split(//)
end

#set(text) ⇒ Object



15
16
17
# File 'lib/mohawk/accessors/text.rb', line 15

def set(text)
  @view.set text
end

#valueObject



11
12
13
# File 'lib/mohawk/accessors/text.rb', line 11

def value
  @view.value
end