Class: PryKeybind::KeySequence
- Inherits:
-
Object
- Object
- PryKeybind::KeySequence
- Defined in:
- lib/pry-keybind.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #for_readline ⇒ Object
-
#initialize(key) ⇒ KeySequence
constructor
A new instance of KeySequence.
- #sequence? ⇒ Boolean
Constructor Details
#initialize(key) ⇒ KeySequence
Returns a new instance of KeySequence.
124 125 126 |
# File 'lib/pry-keybind.rb', line 124 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
122 123 124 |
# File 'lib/pry-keybind.rb', line 122 def key @key end |
Instance Method Details
#for_readline ⇒ Object
128 129 130 131 132 133 134 |
# File 'lib/pry-keybind.rb', line 128 def for_readline unless String === key raise ArgumentError, "can't recognize: key.class == #{key.class} / key.inspect == #{key.inspect}" end [key.chars.map(&:ord)].flatten.pack("C*") end |
#sequence? ⇒ Boolean
136 137 138 |
# File 'lib/pry-keybind.rb', line 136 def sequence? String === key && key.size > 1 end |