Module: Travis::Client::States
- Included in:
- Annotation, Build, Job, Repository
- Defined in:
- lib/travis/client/states.rb
Constant Summary collapse
- STATES =
%w[created queued received started passed failed errored canceled ready]
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
51 52 53 54 |
# File 'lib/travis/client/states.rb', line 51 def canceled? check_state state == 'canceled' end |
#color ⇒ Object
65 66 67 68 69 70 71 |
# 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? ⇒ Boolean
60 61 62 63 |
# File 'lib/travis/client/states.rb', line 60 def created? check_state !!state end |
#errored? ⇒ Boolean
41 42 43 44 |
# File 'lib/travis/client/states.rb', line 41 def errored? check_state state == 'errored' end |
#failed? ⇒ Boolean
46 47 48 49 |
# File 'lib/travis/client/states.rb', line 46 def failed? check_state state == 'failed' end |
#finished? ⇒ Boolean
32 33 34 |
# File 'lib/travis/client/states.rb', line 32 def finished? not pending? end |
#green? ⇒ Boolean
77 78 79 |
# File 'lib/travis/client/states.rb', line 77 def green? color == 'green' end |
#passed? ⇒ Boolean Also known as: successful?
36 37 38 39 |
# File 'lib/travis/client/states.rb', line 36 def passed? check_state state == 'passed' end |
#pending? ⇒ Boolean
12 13 14 15 |
# File 'lib/travis/client/states.rb', line 12 def pending? check_state %w[created started queued received ].include? state end |
#queued? ⇒ Boolean
27 28 29 30 |
# File 'lib/travis/client/states.rb', line 27 def queued? check_state state != 'created' end |
#ready? ⇒ Boolean
8 9 10 |
# File 'lib/travis/client/states.rb', line 8 def ready? state == 'ready' end |
#received? ⇒ Boolean
22 23 24 25 |
# File 'lib/travis/client/states.rb', line 22 def received? check_state state != 'created' and state != 'queued' end |
#red? ⇒ Boolean
81 82 83 |
# File 'lib/travis/client/states.rb', line 81 def red? color == 'red' end |
#running? ⇒ Boolean
85 86 87 |
# File 'lib/travis/client/states.rb', line 85 def running? state == 'started' end |
#started? ⇒ Boolean
17 18 19 20 |
# File 'lib/travis/client/states.rb', line 17 def started? check_state state != 'created' and state != 'received' and state != 'queued' end |
#unsuccessful? ⇒ Boolean
56 57 58 |
# File 'lib/travis/client/states.rb', line 56 def unsuccessful? errored? or failed? or canceled? end |
#yellow? ⇒ Boolean
73 74 75 |
# File 'lib/travis/client/states.rb', line 73 def yellow? color == 'yellow' end |