Class: Karma::Messages::ProcessConfigUpdateMessage
- Inherits:
-
BaseKarmap
- Object
- Base
- BaseKarmap
- Karma::Messages::ProcessConfigUpdateMessage
- Defined in:
- lib/karma_messages/process_config_update_message.rb
Instance Attribute Summary collapse
-
#auto_restart ⇒ Object
readonly
Returns the value of attribute auto_restart.
-
#auto_start ⇒ Object
readonly
Returns the value of attribute auto_start.
-
#cpu_quota ⇒ Object
readonly
Returns the value of attribute cpu_quota.
-
#log_level ⇒ Object
readonly
Returns the value of attribute log_level.
-
#max_running ⇒ Object
readonly
Returns the value of attribute max_running.
-
#memory_max ⇒ Object
readonly
Returns the value of attribute memory_max.
-
#min_running ⇒ Object
readonly
Returns the value of attribute min_running.
-
#notify_interval ⇒ Object
readonly
Returns the value of attribute notify_interval.
-
#num_threads ⇒ Object
readonly
Returns the value of attribute num_threads.
-
#push_notifications ⇒ Object
readonly
Returns the value of attribute push_notifications.
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
#auto_restart ⇒ Object (readonly)
Returns the value of attribute auto_restart.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def auto_restart @auto_restart end |
#auto_start ⇒ Object (readonly)
Returns the value of attribute auto_start.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def auto_start @auto_start end |
#cpu_quota ⇒ Object (readonly)
Returns the value of attribute cpu_quota.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def cpu_quota @cpu_quota end |
#log_level ⇒ Object (readonly)
Returns the value of attribute log_level.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def log_level @log_level end |
#max_running ⇒ Object (readonly)
Returns the value of attribute max_running.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def max_running @max_running end |
#memory_max ⇒ Object (readonly)
Returns the value of attribute memory_max.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def memory_max @memory_max end |
#min_running ⇒ Object (readonly)
Returns the value of attribute min_running.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def min_running @min_running end |
#notify_interval ⇒ Object (readonly)
Returns the value of attribute notify_interval.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def notify_interval @notify_interval end |
#num_threads ⇒ Object (readonly)
Returns the value of attribute num_threads.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def num_threads @num_threads end |
#push_notifications ⇒ Object (readonly)
Returns the value of attribute push_notifications.
5 6 7 |
# File 'lib/karma_messages/process_config_update_message.rb', line 5 def push_notifications @push_notifications end |
Instance Method Details
#parse(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/karma_messages/process_config_update_message.rb', line 7 def parse(params) super(params) @errors << { min_running: 'Required' } if params[:min_running].nil? @errors << { max_running: 'Required' } if params[:max_running].nil? @errors << { auto_restart: 'Required' } if params[:auto_restart].nil? @errors << { auto_start: 'Required' } if params[:auto_start].nil? @errors << { log_level: 'Required' } if params[:log_level].nil? @errors << { num_threads: 'Required' } if params[:num_threads].nil? @memory_max = params[:memory_max] @cpu_quota = params[:cpu_quota] @min_running = params[:min_running] @max_running = params[:max_running] @auto_restart = params[:auto_restart] @auto_start = params[:auto_start] @push_notifications = params[:push_notifications] @log_level = params[:log_level] @num_threads = params[:num_threads] @notify_interval = params[:notify_interval] end |
#to_config ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/karma_messages/process_config_update_message.rb', line 40 def to_config { memory_max: memory_max, cpu_quota: cpu_quota, min_running: min_running, max_running: max_running, auto_restart: auto_restart, auto_start: auto_start, push_notifications: push_notifications, num_threads: num_threads, log_level: log_level, notify_interval: notify_interval } end |
#to_message ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/karma_messages/process_config_update_message.rb', line 29 def ret = super ret.merge!({ min_running: @min_running, max_running: @max_running, auto_restart: @auto_restart, auto_start: @auto_start }) ret.merge!({ log_level: @log_level, num_threads: @num_threads }) ret.merge!({ memory_max: @memory_max} ) if @memory_max.present? ret.merge!({ cpu_quota: @cpu_quota} ) if @cpu_quota.present? ret.merge!({ push_notifications: @push_notifications} ) if @push_notifications.present? ret.merge!({ notify_interval: @notify_interval} ) if @notify_interval.present? ret end |