Class: Delirium::Platform::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/delirium/platform/base.rb,
lib/delirium/platform/base/mouse.rb,
lib/delirium/platform/base/keyboard.rb

Direct Known Subclasses

Darwin, Linux, Windows

Defined Under Namespace

Classes: Keyboard, Mouse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



4
5
6
7
# File 'lib/delirium/platform/base.rb', line 4

def initialize
  @mouse = eval "#{self.class.name}::Mouse.new"
  @keyboard = eval "#{self.class.name}::Keyboard.new"
end

Instance Method Details

#do(device:, action:, params:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/delirium/platform/base.rb', line 9

def do(device:, action:, params:)
  case device
  when :mouse
    @mouse.send action, params
  when :keyboard
    @keyboard.send action, params
  else
    raise Delirium::Error, "unknown device: #{device}"
  end
  nil
end