Class: MultiHeadedGreekMonster::ServiceManager
- Inherits:
-
Object
- Object
- MultiHeadedGreekMonster::ServiceManager
- Defined in:
- lib/multi_headed_greek_monster.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
Returns the value of attribute results.
Instance Method Summary collapse
- #done! ⇒ Object
- #done? ⇒ Boolean
- #give(thing) ⇒ Object
-
#initialize(progress) ⇒ ServiceManager
constructor
A new instance of ServiceManager.
- #q_size ⇒ Object
- #result(thing) ⇒ Object
- #take ⇒ Object
- #tick ⇒ Object
Constructor Details
#initialize(progress) ⇒ ServiceManager
Returns a new instance of ServiceManager.
43 44 45 46 47 48 |
# File 'lib/multi_headed_greek_monster.rb', line 43 def initialize(progress) @progress = progress @things = [] @done = false @results = [] end |
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
39 40 41 |
# File 'lib/multi_headed_greek_monster.rb', line 39 def results @results end |
Instance Method Details
#done! ⇒ Object
61 62 63 |
# File 'lib/multi_headed_greek_monster.rb', line 61 def done! @done = true end |
#done? ⇒ Boolean
58 59 60 |
# File 'lib/multi_headed_greek_monster.rb', line 58 def done? @done && @things && @things.empty? end |
#give(thing) ⇒ Object
40 41 42 |
# File 'lib/multi_headed_greek_monster.rb', line 40 def give(thing) @things.unshift(thing) end |
#q_size ⇒ Object
55 56 57 |
# File 'lib/multi_headed_greek_monster.rb', line 55 def q_size @things && @things.size || 0 end |
#result(thing) ⇒ Object
49 50 51 |
# File 'lib/multi_headed_greek_monster.rb', line 49 def result(thing) @results << thing end |
#take ⇒ Object
52 53 54 |
# File 'lib/multi_headed_greek_monster.rb', line 52 def take @things && @things.pop end |
#tick ⇒ Object
64 65 66 |
# File 'lib/multi_headed_greek_monster.rb', line 64 def tick @progress.tick if @progress end |