Class: Eye::Group
- Includes:
- Celluloid, Call, Chain, Data, Process::Scheduler
- Defined in:
- lib/eye/group.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#processes ⇒ Object
readonly
Returns the value of attribute processes.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
to sort groups.
- #add_process(process) ⇒ Object
- #app_name ⇒ Object
- #clear ⇒ Object
- #full_name ⇒ Object
-
#initialize(name, config) ⇒ Group
constructor
A new instance of Group.
- #logger_tag ⇒ Object
-
#resort_processes ⇒ Object
sort processes in name order.
- #sub_object?(obj) ⇒ Boolean
Methods included from Data
#debug_data, #status_data, #status_data_short
Methods included from Call
#break_chain, #delete, #monitor, #restart, #send_call, #signal, #start, #stop, #unmonitor, #update_config, #user_command
Methods included from Process::Scheduler
#ensure_scheduler_process, #equal_action_call?, #filter_call, #internal_schedule, #schedule, #scheduler_add, #scheduler_calls, #scheduler_clear_pending_list, #scheduler_commands_list, #scheduler_consume, #scheduler_current_command, #scheduler_history, #scheduler_last_command, #scheduler_last_reason, #scheduler_run, #send_call, #user_schedule
Constructor Details
#initialize(name, config) ⇒ Group
Returns a new instance of Group.
18 19 20 21 22 23 24 |
# File 'lib/eye/group.rb', line 18 def initialize(name, config) @name = name @config = config @processes = Eye::Utils::AliveArray.new @hidden = (name == '__default__') debug { 'created' } end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
16 17 18 |
# File 'lib/eye/group.rb', line 16 def config @config end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden.
16 17 18 |
# File 'lib/eye/group.rb', line 16 def hidden @hidden end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/eye/group.rb', line 16 def name @name end |
#processes ⇒ Object (readonly)
Returns the value of attribute processes.
16 17 18 |
# File 'lib/eye/group.rb', line 16 def processes @processes end |
Instance Method Details
#<=>(other) ⇒ Object
to sort groups
56 57 58 59 60 61 62 63 64 |
# File 'lib/eye/group.rb', line 56 def <=>(other) if hidden 1 elsif other.hidden -1 else name <=> other.name end end |
#add_process(process) ⇒ Object
38 39 40 |
# File 'lib/eye/group.rb', line 38 def add_process(process) @processes << process end |
#app_name ⇒ Object
30 31 32 |
# File 'lib/eye/group.rb', line 30 def app_name @config[:application] end |
#clear ⇒ Object
47 48 49 |
# File 'lib/eye/group.rb', line 47 def clear @processes = Eye::Utils::AliveArray.new end |
#full_name ⇒ Object
34 35 36 |
# File 'lib/eye/group.rb', line 34 def full_name @full_name ||= "#{app_name}:#{@name}" end |
#logger_tag ⇒ Object
26 27 28 |
# File 'lib/eye/group.rb', line 26 def logger_tag full_name end |
#resort_processes ⇒ Object
sort processes in name order
43 44 45 |
# File 'lib/eye/group.rb', line 43 def resort_processes @processes = @processes.sort_by(&:name) end |
#sub_object?(obj) ⇒ Boolean
51 52 53 |
# File 'lib/eye/group.rb', line 51 def sub_object?(obj) @processes.include?(obj) end |