Module: Travis::Client::States
- Included in:
- Build, Job, Repository
- Defined in:
- lib/travis/client/states.rb
Constant Summary collapse
- STATES =
%w[created queued received started passed failed errored canceled ready].freeze
Instance Method Summary collapse
- #canceled? ⇒ Boolean
- #color ⇒ Object
- #created? ⇒ Boolean
- #errored? ⇒ Boolean
- #failed? ⇒ Boolean
- #finished? ⇒ Boolean
- #green? ⇒ Boolean
- #passed? ⇒ Boolean (also: #successful?)
- #pending? ⇒ Boolean
- #queued? ⇒ Boolean
- #ready? ⇒ Boolean
- #received? ⇒ Boolean
- #red? ⇒ Boolean
- #running? ⇒ Boolean
- #started? ⇒ Boolean
- #unsuccessful? ⇒ Boolean
- #yellow? ⇒ Boolean
Instance Method Details
#canceled? ⇒ Boolean
53 54 55 56 |
# File 'lib/travis/client/states.rb', line 53 def canceled? check_state state == 'canceled' end |
#color ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/travis/client/states.rb', line 67 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? ⇒ Boolean
62 63 64 65 |
# File 'lib/travis/client/states.rb', line 62 def created? check_state !!state end |
#errored? ⇒ Boolean
43 44 45 46 |
# File 'lib/travis/client/states.rb', line 43 def errored? check_state state == 'errored' end |
#failed? ⇒ Boolean
48 49 50 51 |
# File 'lib/travis/client/states.rb', line 48 def failed? check_state state == 'failed' end |
#finished? ⇒ Boolean
34 35 36 |
# File 'lib/travis/client/states.rb', line 34 def finished? !pending? end |
#green? ⇒ Boolean
79 80 81 |
# File 'lib/travis/client/states.rb', line 79 def green? color == 'green' end |
#passed? ⇒ Boolean Also known as: successful?
38 39 40 41 |
# File 'lib/travis/client/states.rb', line 38 def passed? check_state state == 'passed' end |
#pending? ⇒ Boolean
14 15 16 17 |
# File 'lib/travis/client/states.rb', line 14 def pending? check_state %w[created started queued received].include? state end |
#queued? ⇒ Boolean
29 30 31 32 |
# File 'lib/travis/client/states.rb', line 29 def queued? check_state state != 'created' end |
#ready? ⇒ Boolean
10 11 12 |
# File 'lib/travis/client/states.rb', line 10 def ready? state == 'ready' end |
#received? ⇒ Boolean
24 25 26 27 |
# File 'lib/travis/client/states.rb', line 24 def received? check_state state != 'created' and state != 'queued' end |
#red? ⇒ Boolean
83 84 85 |
# File 'lib/travis/client/states.rb', line 83 def red? color == 'red' end |
#running? ⇒ Boolean
87 88 89 |
# File 'lib/travis/client/states.rb', line 87 def running? state == 'started' end |
#started? ⇒ Boolean
19 20 21 22 |
# File 'lib/travis/client/states.rb', line 19 def started? check_state state != 'created' and state != 'received' and state != 'queued' end |
#unsuccessful? ⇒ Boolean
58 59 60 |
# File 'lib/travis/client/states.rb', line 58 def unsuccessful? errored? or failed? or canceled? end |
#yellow? ⇒ Boolean
75 76 77 |
# File 'lib/travis/client/states.rb', line 75 def yellow? color == 'yellow' end |