Module: Nobbie::Wx::Operations

Defined in:
lib/nobbie/wx/operations.rb

Constant Summary collapse

EXECUTOR =
Command::Executor.new

Instance Method Summary collapse

Instance Method Details

#choosable(path) ⇒ Object

Returns a ChoosableOperations for interacting with the component specified in the path



47
48
49
# File 'lib/nobbie/wx/operations.rb', line 47

def choosable(path)
  ChoosableOperations.new(self, coerce_path((path)))
end

#click(path) ⇒ Object

Clicks the component specified in the path.

Supported components: Button


28
29
30
# File 'lib/nobbie/wx/operations.rb', line 28

def click(path)
  execute(command_factory.create_click_on_command(coerce_path(path)))
end

#command_factoryObject

Creates an instance of the default command factory. Override this method if you wish to provide an alternative command factory.



66
67
68
# File 'lib/nobbie/wx/operations.rb', line 66

def command_factory
  Command::Factory.new
end

#component(path) ⇒ Object

Returns the component specified in the path. Useful for performing operations that Nobbie does not currently support.

Supported components: Any


35
36
37
# File 'lib/nobbie/wx/operations.rb', line 35

def component(path)
  execute(command_factory.create_get_component_command(coerce_path(path)))
end

#enabled?(path) ⇒ Boolean

Determines if the component specified in the path is currently enabled.

Supported components: Any

Returns:

  • (Boolean)


53
54
55
# File 'lib/nobbie/wx/operations.rb', line 53

def enabled?(path)
  execute(command_factory.create_is_enabled_command(coerce_path(path)))
end

#execute(command) ⇒ Object



70
71
72
# File 'lib/nobbie/wx/operations.rb', line 70

def execute(command)
  EXECUTOR.execute(command)
end

#in_(name) ⇒ Object

Creates an instance of the default path builder. Override this method if you wish to provide an alternative default path builder (because coerce_path uses in_() internally).



60
61
62
# File 'lib/nobbie/wx/operations.rb', line 60

def in_(name)
  ElementPathBuilder.new(name)
end

#selection(path) ⇒ Object

Returns a SelectionOperations for interacting with the component specified in the path



41
42
43
# File 'lib/nobbie/wx/operations.rb', line 41

def selection(path)
  SelectOperations.new(self, coerce_path(path))
end

#text(path) ⇒ Object

Returns the text in the component specified in the path.

Supported components: TextCtrl, ComboBox


21
22
23
24
# File 'lib/nobbie/wx/operations.rb', line 21

def text(path)
  component = component(path)
  component.nil? ? nil : component.value
end

#type(text, path) ⇒ Object

Types text into the component specified in the path.

Supported components: TextCtrl, ComboBox


15
16
17
# File 'lib/nobbie/wx/operations.rb', line 15

def type(text, path)
  execute(command_factory.create_type_into_command(coerce_path(path), text))
end