Class: Yildun::Keymap
- Inherits:
-
Object
- Object
- Yildun::Keymap
- Defined in:
- lib/yildun/keymap.rb,
sig/yildun.rbs
Instance Method Summary collapse
- #command(key) ⇒ String?
- #include?(key) ⇒ Boolean
-
#initialize(bindings = {}) ⇒ Keymap
constructor
A new instance of Keymap.
- #to_h ⇒ Object
Constructor Details
#initialize(bindings = {}) ⇒ Keymap
Returns a new instance of Keymap.
5 6 7 |
# File 'lib/yildun/keymap.rb', line 5 def initialize(bindings = {}) @bindings = bindings.to_h.transform_keys(&:to_s).freeze end |
Instance Method Details
#command(key) ⇒ String?
9 |
# File 'lib/yildun/keymap.rb', line 9 def command(key) = @bindings[key.to_s] |
#include?(key) ⇒ Boolean
10 |
# File 'lib/yildun/keymap.rb', line 10 def include?(key) = @bindings.key?(key.to_s) |
#to_h ⇒ Object
11 |
# File 'lib/yildun/keymap.rb', line 11 def to_h = @bindings |