Class: SDC::AI::Script
- Inherits:
-
Object
- Object
- SDC::AI::Script
- Defined in:
- lib/core/AI.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ Script
constructor
A new instance of Script.
- #running? ⇒ Boolean
- #tick ⇒ Object
Constructor Details
#initialize(&block) ⇒ Script
Returns a new instance of Script.
17 18 19 |
# File 'lib/core/AI.rb', line 17 def initialize(&block) @fiber = Fiber.new {block.call} end |
Instance Method Details
#running? ⇒ Boolean
25 26 27 |
# File 'lib/core/AI.rb', line 25 def running? return @fiber.alive? end |
#tick ⇒ Object
21 22 23 |
# File 'lib/core/AI.rb', line 21 def tick @fiber.resume end |