Class: Delirium::Platform::Base
- Inherits:
-
Object
- Object
- Delirium::Platform::Base
- Defined in:
- lib/delirium/platform/base.rb,
lib/delirium/platform/base/mouse.rb,
lib/delirium/platform/base/keyboard.rb
Defined Under Namespace
Instance Method Summary collapse
- #do(device:, action:, params:) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
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 |