Class: MultiHeadedGreekMonster::ServiceManager

Inherits:
Object
  • Object
show all
Defined in:
lib/multi_headed_greek_monster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#resultsObject

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

Returns:

  • (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_sizeObject



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

#takeObject



52
53
54
# File 'lib/multi_headed_greek_monster.rb', line 52

def take
  @things && @things.pop
end

#tickObject



64
65
66
# File 'lib/multi_headed_greek_monster.rb', line 64

def tick
  @progress.tick if @progress
end