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.
133 134 135 |
# File 'lib/pry-keybind.rb', line 133 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
131 132 133 |
# File 'lib/pry-keybind.rb', line 131 def key @key end |
Instance Method Details
#for_readline ⇒ Object
137 138 139 140 141 142 143 |
# File 'lib/pry-keybind.rb', line 137 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
145 146 147 |
# File 'lib/pry-keybind.rb', line 145 def sequence? String === key && key.size > 1 end |