Sha256: 0d01c5a76cc043b483b1882ebef340343fd133bbb82bdd672a1bd58715cefe10
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
module Seam class Flow def initialize @steps = [] end def method_missing(meth, *args, &blk) meth = meth.to_s @steps << { name: meth, arguments: args } true end def start(data = {}) Seam::Effort.create( { id: SecureRandom.uuid.to_s, created_at: Time.parse(Time.now.to_s), next_execute_at: Time.parse(Time.now.to_s), next_step: self.steps.first.name.to_s, flow: ActiveSupport::HashWithIndifferentAccess.new(self.to_hash), data: ActiveSupport::HashWithIndifferentAccess.new(data) } ) end def to_hash { steps: self.steps.map { |x| x.to_hash } } end def steps @steps.each.map do |step| Seam::Step.new( { name: step[:name], type: 'do', arguments: step[:arguments] } ) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
seam-0.0.14 | lib/seam/flow.rb |
seam-0.0.13 | lib/seam/flow.rb |
seam-0.0.12 | lib/seam/flow.rb |
seam-0.0.11 | lib/seam/flow.rb |
seam-0.0.10 | lib/seam/flow.rb |