Class: Circler::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/circler/response/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Action

Returns a new instance of Action.



5
6
7
8
9
10
# File 'lib/circler/response/action.rb', line 5

def initialize(hash)
  @hash = hash
  @name = hash['name']
  @status = hash['status']
  @run_time_millis = hash['run_time_millis']
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/circler/response/action.rb', line 4

def name
  @name
end

#run_time_millisObject (readonly)

Returns the value of attribute run_time_millis.



4
5
6
# File 'lib/circler/response/action.rb', line 4

def run_time_millis
  @run_time_millis
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/circler/response/action.rb', line 4

def status
  @status
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/circler/response/action.rb', line 24

def failed?
  @status == 'timedout' || @status == 'failed'
end

#logObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/circler/response/action.rb', line 12

def log
  request(@hash['output_url'])
    .map{ |r|
      r['message']
        .gsub(/\r\n/, "\n")
        .gsub(/\e\[A\r\e\[2K/, '')
        .scan(/.{1,120}/)
        .join("\n")
    }
    .join("\n")
end