Sha256: 234052dc3d3173487fc2fe8ac9179deec3279b5ae20602ed45c11701ebe8d867
Contents?: true
Size: 848 Bytes
Versions: 20
Compression:
Stored size: 848 Bytes
Contents
module Smash module CloudPowers class Workflow attr_accessor :all_states, :first, :last, :previous, :states 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 def current @states.first end def finished? @states.first == @states.last end def next finished ? @states.first : @states[1] end def next! return if finished? @previous << @states.shift @states.first end end end end
Version data entries
20 entries across 20 versions & 1 rubygems