Class: Smash::Workflow
- Inherits:
-
Object
- Object
- Smash::Workflow
- Defined in:
- lib/cloud_powers/workflow.rb
Instance Attribute Summary collapse
-
#all_states ⇒ Object
Returns the value of attribute all_states.
-
#first ⇒ Object
Returns the value of attribute first.
-
#last ⇒ Object
Returns the value of attribute last.
-
#previous ⇒ Object
Returns the value of attribute previous.
-
#states ⇒ Object
Returns the value of attribute states.
Instance Method Summary collapse
- #current ⇒ Object
- #finished? ⇒ Boolean
-
#initialize(statez = nil) ⇒ Workflow
constructor
A new instance of Workflow.
- #next ⇒ Object
- #next! ⇒ Object
Constructor Details
#initialize(statez = nil) ⇒ Workflow
Returns a new instance of Workflow.
5 6 7 8 9 10 11 12 |
# File 'lib/cloud_powers/workflow.rb', line 5 def initialize(statez = nil) # TODO: figure out wtf here with the i-vars changing each other @all_states = statez || [:backlog, :wip, :done] @states = statez || [:backlog, :wip, :done] @first = (statez || [:backlog, :wip, :done]).first @last = (statez || [:backlog, :wip, :done]).last @previous = [(statez || [:backlog, :wip, :done]).first] end |
Instance Attribute Details
#all_states ⇒ Object
Returns the value of attribute all_states.
3 4 5 |
# File 'lib/cloud_powers/workflow.rb', line 3 def all_states @all_states end |
#first ⇒ Object
Returns the value of attribute first.
3 4 5 |
# File 'lib/cloud_powers/workflow.rb', line 3 def first @first end |
#last ⇒ Object
Returns the value of attribute last.
3 4 5 |
# File 'lib/cloud_powers/workflow.rb', line 3 def last @last end |
#previous ⇒ Object
Returns the value of attribute previous.
3 4 5 |
# File 'lib/cloud_powers/workflow.rb', line 3 def previous @previous end |
#states ⇒ Object
Returns the value of attribute states.
3 4 5 |
# File 'lib/cloud_powers/workflow.rb', line 3 def states @states end |
Instance Method Details
#current ⇒ Object
14 15 16 |
# File 'lib/cloud_powers/workflow.rb', line 14 def current @states.first end |
#finished? ⇒ Boolean
18 19 20 |
# File 'lib/cloud_powers/workflow.rb', line 18 def finished? @states.first == @states.last end |
#next ⇒ Object
22 23 24 |
# File 'lib/cloud_powers/workflow.rb', line 22 def next finished ? @states.first : @states[1] end |
#next! ⇒ Object
26 27 28 29 30 |
# File 'lib/cloud_powers/workflow.rb', line 26 def next! return if finished? @previous << @states.shift @states.first end |