Class: Keylogger
- Inherits:
-
Object
- Object
- Keylogger
- Defined in:
- lib/keylogger.rb,
lib/input_devices.rb
Defined Under Namespace
Modules: InputDevices
Constant Summary collapse
- SUPPORTED_PLATFORMS =
%w[x86_64-linux x86_64-linux-gnu].freeze
- FORMAT =
"l!<l!<HHI!<".freeze
- MIN_ID =
0
- MAX_ID =
59
- DeviceNotFoundError =
Class.new(StandardError)
- WrongPlatformError =
Class.new(StandardError)
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ Keylogger
constructor
A new instance of Keylogger.
- #listen ⇒ Object
Constructor Details
#initialize(name = nil) ⇒ Keylogger
Returns a new instance of Keylogger.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/keylogger.rb', line 11 def initialize(name = nil) @device = InputDevices.find_by_name(name) || InputDevices.default unless SUPPORTED_PLATFORMS.include?(RUBY_PLATFORM) raise WrongPlatformError, "platform #{RUBY_PLATFORM} not supported" end raise DeviceNotFoundError unless @device end |