Class: Badline::Cycleable
- Inherits:
-
Object
- Object
- Badline::Cycleable
- Defined in:
- lib/badline/cycleable.rb
Instance Attribute Summary collapse
-
#cycles ⇒ Object
readonly
Returns the value of attribute cycles.
Instance Method Summary collapse
- #cycle! ⇒ Object
-
#initialize ⇒ Cycleable
constructor
A new instance of Cycleable.
- #pending_write? ⇒ Boolean
Constructor Details
#initialize ⇒ Cycleable
Returns a new instance of Cycleable.
7 8 9 10 11 |
# File 'lib/badline/cycleable.rb', line 7 def initialize @loop = Fiber.new { loop { main_loop } } @cycles = 0 @pending_write = false end |
Instance Attribute Details
#cycles ⇒ Object (readonly)
Returns the value of attribute cycles.
5 6 7 |
# File 'lib/badline/cycleable.rb', line 5 def cycles @cycles end |
Instance Method Details
#cycle! ⇒ Object
13 14 15 16 |
# File 'lib/badline/cycleable.rb', line 13 def cycle! @loop.resume nil end |
#pending_write? ⇒ Boolean
18 |
# File 'lib/badline/cycleable.rb', line 18 def pending_write? = @pending_write |