Class: Karma::Messages::ProcessStatusUpdateMessage
- Defined in:
- lib/karma_messages/process_status_update_message.rb
Constant Summary collapse
- STATUSES =
{running: 'running', stopped: 'stopped', dead: 'dead'}.freeze
Instance Attribute Summary collapse
-
#active_threads ⇒ Object
readonly
Returns the value of attribute active_threads.
-
#cpu ⇒ Object
readonly
Returns the value of attribute cpu.
-
#current_version ⇒ Object
readonly
Returns the value of attribute current_version.
-
#execution_time ⇒ Object
readonly
Returns the value of attribute execution_time.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#performance ⇒ Object
readonly
Returns the value of attribute performance.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Attributes inherited from BaseKarma
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#clear_errors, #initialize, #message_type, #valid?
Constructor Details
This class inherits a constructor from Karma::Messages::Base
Instance Attribute Details
#active_threads ⇒ Object (readonly)
Returns the value of attribute active_threads.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def active_threads @active_threads end |
#cpu ⇒ Object (readonly)
Returns the value of attribute cpu.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def cpu @cpu end |
#current_version ⇒ Object (readonly)
Returns the value of attribute current_version.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def current_version @current_version end |
#execution_time ⇒ Object (readonly)
Returns the value of attribute execution_time.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def execution_time @execution_time end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def memory @memory end |
#performance ⇒ Object (readonly)
Returns the value of attribute performance.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def performance @performance end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def pid @pid end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/karma_messages/process_status_update_message.rb', line 7 def status @status end |
Instance Method Details
#parse(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/karma_messages/process_status_update_message.rb', line 9 def parse(params) super(params) @errors << {pid: 'Required'} if params[:pid].nil? @errors << {status: 'Not a valid status'} if params[:status].nil? && !STATUSES.values.include?(params[:status]) @pid = params[:pid] @status = params[:status] @active_threads = params[:active_threads] @execution_time = params[:execution_time] @performance = params[:performance] @current_version = params[:current_version] @cpu = params[:cpu] @memory = params[:memory] end |
#to_message ⇒ Object
24 25 26 27 |
# File 'lib/karma_messages/process_status_update_message.rb', line 24 def ret = super ret.merge!({ pid: @pid, status: @status, active_threads: @active_threads, execution_time: @execution_time, performance: @performance, current_version: @current_version, cpu: @cpu, memory: @memory }) end |