Class: Circler::Action
- Inherits:
-
Object
- Object
- Circler::Action
- Defined in:
- lib/circler/response/action.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#run_time_millis ⇒ Object
readonly
Returns the value of attribute run_time_millis.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(hash) ⇒ Action
constructor
A new instance of Action.
- #log ⇒ Object
Constructor Details
#initialize(hash) ⇒ Action
Returns a new instance of Action.
4 5 6 7 8 9 |
# File 'lib/circler/response/action.rb', line 4 def initialize(hash) @hash = hash @name = hash['name'] @status = hash['status'] @run_time_millis = hash['run_time_millis'] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/circler/response/action.rb', line 3 def name @name end |
#run_time_millis ⇒ Object (readonly)
Returns the value of attribute run_time_millis.
3 4 5 |
# File 'lib/circler/response/action.rb', line 3 def run_time_millis @run_time_millis end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/circler/response/action.rb', line 3 def status @status end |
Instance Method Details
#failed? ⇒ Boolean
23 24 25 |
# File 'lib/circler/response/action.rb', line 23 def failed? @status == 'timedout' || @status == 'failed' end |
#log ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/circler/response/action.rb', line 11 def log request(@hash['output_url']) .map do |r| r['message'] .gsub(/\r\n/, "\n") .gsub(/\e\[A\r\e\[2K/, '') .scan(/.{1,120}/) .join("\n") end .join("\n") end |