Class: Fir::Key
- Inherits:
-
Object
- Object
- Fir::Key
- Defined in:
- lib/fir/key.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(input) ⇒ Key
constructor
A new instance of Key.
Constructor Details
#initialize(input) ⇒ Key
Returns a new instance of Key.
8 9 10 |
# File 'lib/fir/key.rb', line 8 def initialize(input) @input = input end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
6 7 8 |
# File 'lib/fir/key.rb', line 6 def input @input end |
Instance Method Details
#get ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fir/key.rb', line 12 def get input.raw do |raw_input| key = raw_input.sysread(1).chr if key == "\e" skt = Thread.new { 2.times { key += raw_input.sysread(1).chr } } skt.join(0.0001) skt.kill end key end end |