Class: Deskbot::Event::KeyDown

Inherits:
Event
  • Object
show all
Defined in:
lib/deskbot/event.rb

Overview

A key was pressed down. Exposes the pressed #key.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, recorded_at:) ⇒ KeyDown

Returns a new instance of KeyDown.



59
60
61
62
# File 'lib/deskbot/event.rb', line 59

def initialize(key:, recorded_at:)
  @key = key.to_sym
  @recorded_at = recorded_at
end

Instance Attribute Details

#key ⇒ Object (readonly)

Returns the value of attribute key.



57
58
59
# File 'lib/deskbot/event.rb', line 57

def key
  @key
end

Class Method Details

.build(payload) ⇒ Object



64
65
66
# File 'lib/deskbot/event.rb', line 64

def self.build(payload)
  new(key: payload["key"], recorded_at: recorded_at_from(payload))
end