Sha256: f6404eeb4bc8c698df30ad9765d0a6a3390a0adeb94417ca9f42c22ca2c58dc4

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

module Trailblazer::V2_1
  class Activity::Path < Activity
    def self.Plan()
      Plan
    end

    module Plan
      def self.extended(extended)
        extended.singleton_class.send :attr_accessor, :record
        extended.record = []
        extended.extend(Methods)
      end

      module Methods
        def task(*args, &block)
          record << [:task, args, block]
        end
      end

      def self.merge!(activity, plan)
        plan.record.each { |(dsl_method, args, block)| activity.send(dsl_method, *args, &block)  }
        activity
      end

      # Creates a copy of the {activity} module and merges the {Plan} into it.
      #
      # @params activity [Activity] The activity to extend
      # @params plan [Plan] The plan providing additional steps
      # @return [Activity] A new, merged activity
      def self.merge(activity, plan)
        merge!(activity.clone, plan)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trailblazer-future-2.1.0.rc1 lib/trailblazer/v2_1/activity/dsl/strategy/plan.rb