Class: Sponges::Store
- Inherits:
-
Object
- Object
- Sponges::Store
- Extended by:
- Forwardable
- Defined in:
- lib/sponges/store.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pids ⇒ Object
readonly
Returns the value of attribute pids.
- #supervisor_pid ⇒ Object
Instance Method Summary collapse
- #children_pids ⇒ Object
- #clear(name) ⇒ Object
-
#initialize(name) ⇒ Store
constructor
A new instance of Store.
- #register(supervisor_pid) ⇒ Object
- #running? ⇒ Boolean
Constructor Details
#initialize(name) ⇒ Store
Returns a new instance of Store.
9 10 11 |
# File 'lib/sponges/store.rb', line 9 def initialize(name) @pids, @name = [], name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/sponges/store.rb', line 7 def name @name end |
#pids ⇒ Object (readonly)
Returns the value of attribute pids.
7 8 9 |
# File 'lib/sponges/store.rb', line 7 def pids @pids end |
#supervisor_pid ⇒ Object
16 17 18 19 20 |
# File 'lib/sponges/store.rb', line 16 def supervisor_pid return @supervisor_pid if @supervisor_pid s = find_supervisor @supervisor_pid = s.pid if s end |
Instance Method Details
#children_pids ⇒ Object
22 23 24 |
# File 'lib/sponges/store.rb', line 22 def children_pids @pids.any? ? @pids : find_childs.map(&:pid) end |
#clear(name) ⇒ Object
34 35 36 |
# File 'lib/sponges/store.rb', line 34 def clear(name) pids.clear end |
#register(supervisor_pid) ⇒ Object
30 31 32 |
# File 'lib/sponges/store.rb', line 30 def register(supervisor_pid) @supervisor_pid = supervisor_pid end |
#running? ⇒ Boolean
26 27 28 |
# File 'lib/sponges/store.rb', line 26 def running? !!find_supervisor end |