Class: Charming::KeyEvent
- Inherits:
-
Data
- Object
- Data
- Charming::KeyEvent
- Defined in:
- lib/charming/key_event.rb
Overview
KeyEvent represents a terminal key press parsed by the backend. key is the normalized semantic action name (e.g., ‘:up`, `:down`, `:q`), while char, ctrl, alt, and shift capture raw input details for custom bindings.
Instance Attribute Summary collapse
-
#alt ⇒ Object
readonly
Returns the value of attribute alt.
-
#char ⇒ Object
readonly
Returns the value of attribute char.
-
#ctrl ⇒ Object
readonly
Returns the value of attribute ctrl.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#shift ⇒ Object
readonly
Returns the value of attribute shift.
Instance Method Summary collapse
-
#initialize(key:, char: nil, ctrl: false, alt: false, shift: false) ⇒ KeyEvent
constructor
Constructs a key event with the required key symbol, plus optional char string and modifier booleans.
Constructor Details
#initialize(key:, char: nil, ctrl: false, alt: false, shift: false) ⇒ KeyEvent
Constructs a key event with the required key symbol, plus optional char string and modifier booleans.
9 10 11 |
# File 'lib/charming/key_event.rb', line 9 def initialize(key:, char: nil, ctrl: false, alt: false, shift: false) super(key: key.to_sym, char: char, ctrl: ctrl, alt: alt, shift: shift) end |
Instance Attribute Details
#alt ⇒ Object (readonly)
Returns the value of attribute alt
7 8 9 |
# File 'lib/charming/key_event.rb', line 7 def alt @alt end |
#char ⇒ Object (readonly)
Returns the value of attribute char
7 8 9 |
# File 'lib/charming/key_event.rb', line 7 def char @char end |
#ctrl ⇒ Object (readonly)
Returns the value of attribute ctrl
7 8 9 |
# File 'lib/charming/key_event.rb', line 7 def ctrl @ctrl end |
#key ⇒ Object (readonly)
Returns the value of attribute key
7 8 9 |
# File 'lib/charming/key_event.rb', line 7 def key @key end |
#shift ⇒ Object (readonly)
Returns the value of attribute shift
7 8 9 |
# File 'lib/charming/key_event.rb', line 7 def shift @shift end |