Class: ScriptExecution
- Inherits:
-
Object
- Object
- ScriptExecution
- Defined in:
- lib/rscalr/model/script_execution.rb
Instance Attribute Summary collapse
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#farm_id ⇒ Object
readonly
Returns the value of attribute farm_id.
-
#farm_role_id ⇒ Object
readonly
Returns the value of attribute farm_role_id.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#script_id ⇒ Object
readonly
Returns the value of attribute script_id.
-
#server_id ⇒ Object
readonly
Returns the value of attribute server_id.
-
#server_results ⇒ Object
readonly
Returns the value of attribute server_results.
Instance Method Summary collapse
- #add_server(server_id) ⇒ Object
-
#initialize(script_id, result, event_id, farm_id, farm_role_id = nil, server_id = nil) ⇒ ScriptExecution
constructor
A new instance of ScriptExecution.
- #set_server_result(log) ⇒ Object
- #success? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(script_id, result, event_id, farm_id, farm_role_id = nil, server_id = nil) ⇒ ScriptExecution
Returns a new instance of ScriptExecution.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rscalr/model/script_execution.rb', line 4 def initialize(script_id, result, event_id, farm_id, farm_role_id=nil, server_id=nil) @script_id = script_id @result = result @result = 0 if @result != 1 @event_id = event_id @farm_id = farm_id @farm_role_id = farm_role_id @server_id = server_id # instance field to store execution results @server_results = {} end |
Instance Attribute Details
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
2 3 4 |
# File 'lib/rscalr/model/script_execution.rb', line 2 def event_id @event_id end |
#farm_id ⇒ Object (readonly)
Returns the value of attribute farm_id.
2 3 4 |
# File 'lib/rscalr/model/script_execution.rb', line 2 def farm_id @farm_id end |
#farm_role_id ⇒ Object (readonly)
Returns the value of attribute farm_role_id.
2 3 4 |
# File 'lib/rscalr/model/script_execution.rb', line 2 def farm_role_id @farm_role_id end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
2 3 4 |
# File 'lib/rscalr/model/script_execution.rb', line 2 def result @result end |
#script_id ⇒ Object (readonly)
Returns the value of attribute script_id.
2 3 4 |
# File 'lib/rscalr/model/script_execution.rb', line 2 def script_id @script_id end |
#server_id ⇒ Object (readonly)
Returns the value of attribute server_id.
2 3 4 |
# File 'lib/rscalr/model/script_execution.rb', line 2 def server_id @server_id end |
#server_results ⇒ Object (readonly)
Returns the value of attribute server_results.
2 3 4 |
# File 'lib/rscalr/model/script_execution.rb', line 2 def server_results @server_results end |
Instance Method Details
#add_server(server_id) ⇒ Object
21 22 23 |
# File 'lib/rscalr/model/script_execution.rb', line 21 def add_server(server_id) @server_results[server_id] = nil end |
#set_server_result(log) ⇒ Object
25 26 27 |
# File 'lib/rscalr/model/script_execution.rb', line 25 def set_server_result(log) @server_results[log.server_id] = log if @server_results.has_key?(log.server_id) end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/rscalr/model/script_execution.rb', line 17 def success? @result == 1 end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/rscalr/model/script_execution.rb', line 29 def to_s "{ type: \"script_execution\", script_id: #{@script_id}, result: #{@result}, event_id: \"#{@event_id}\"}" end |