module Travis::Client::States

Constants

STATES

Public Instance Methods

canceled?() click to toggle source
# File lib/travis/client/states.rb, line 51
def canceled?
  check_state
  state == 'canceled'
end
color() click to toggle source
# File lib/travis/client/states.rb, line 65
def color
  case state
  when 'created', 'queued', 'received', 'started' then 'yellow'
  when 'passed', 'ready'                then 'green'
  when 'errored', 'canceled', 'failed'  then 'red'
  end
end
created?() click to toggle source
# File lib/travis/client/states.rb, line 60
def created?
  check_state
  !!state
end
errored?() click to toggle source
# File lib/travis/client/states.rb, line 41
def errored?
  check_state
  state == 'errored'
end
failed?() click to toggle source
# File lib/travis/client/states.rb, line 46
def failed?
  check_state
  state == 'failed'
end
finished?() click to toggle source
# File lib/travis/client/states.rb, line 32
def finished?
  not pending?
end
green?() click to toggle source
# File lib/travis/client/states.rb, line 77
def green?
  color == 'green'
end
passed?() click to toggle source
# File lib/travis/client/states.rb, line 36
def passed?
  check_state
  state == 'passed'
end
Also aliased as: successful?
pending?() click to toggle source
# File lib/travis/client/states.rb, line 12
def pending?
  check_state
  %w[created started queued received ].include? state
end
queued?() click to toggle source
# File lib/travis/client/states.rb, line 27
def queued?
  check_state
  state != 'created'
end
ready?() click to toggle source
# File lib/travis/client/states.rb, line 8
def ready?
  state == 'ready'
end
received?() click to toggle source
# File lib/travis/client/states.rb, line 22
def received?
  check_state
  state != 'created' and state != 'queued'
end
red?() click to toggle source
# File lib/travis/client/states.rb, line 81
def red?
  color == 'red'
end
running?() click to toggle source
# File lib/travis/client/states.rb, line 85
def running?
  state == 'started'
end
started?() click to toggle source
# File lib/travis/client/states.rb, line 17
def started?
  check_state
  state != 'created' and state != 'received' and state != 'queued'
end
successful?()
Alias for: passed?
unsuccessful?() click to toggle source
# File lib/travis/client/states.rb, line 56
def unsuccessful?
  errored? or failed? or canceled?
end
yellow?() click to toggle source
# File lib/travis/client/states.rb, line 73
def yellow?
  color == 'yellow'
end

Private Instance Methods

check_state() click to toggle source
# File lib/travis/client/states.rb, line 93
def check_state
  raise Error, "unknown state %p for %p" % [state, self] unless STATES.include? state
end