Class: CircleCI::CLI::Response::Action
- Inherits:
-
Object
- Object
- CircleCI::CLI::Response::Action
- Defined in:
- lib/circleci/cli/response/action.rb
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#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.
-
#step ⇒ Object
readonly
Returns the value of attribute step.
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.
9 10 11 12 13 14 15 16 17 |
# File 'lib/circleci/cli/response/action.rb', line 9 def initialize(hash) @hash = hash @name = hash['name'] @status = hash['status'] @index = hash['index'] @step = hash['step'] @end_time = hash['end_time'] @run_time_millis = hash['run_time_millis'] end |
Instance Attribute Details
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
7 8 9 |
# File 'lib/circleci/cli/response/action.rb', line 7 def end_time @end_time end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
7 8 9 |
# File 'lib/circleci/cli/response/action.rb', line 7 def index @index end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/circleci/cli/response/action.rb', line 7 def name @name end |
#run_time_millis ⇒ Object (readonly)
Returns the value of attribute run_time_millis.
7 8 9 |
# File 'lib/circleci/cli/response/action.rb', line 7 def run_time_millis @run_time_millis end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/circleci/cli/response/action.rb', line 7 def status @status end |
#step ⇒ Object (readonly)
Returns the value of attribute step.
7 8 9 |
# File 'lib/circleci/cli/response/action.rb', line 7 def step @step end |
Instance Method Details
#failed? ⇒ Boolean
31 32 33 |
# File 'lib/circleci/cli/response/action.rb', line 31 def failed? @status == 'timedout' || @status == 'failed' end |
#log ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/circleci/cli/response/action.rb', line 19 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 |