Sha256: 2d313b4c110f49144a493dce5bdbfd6e3570adbf1281311039e6b5c2dff09d1c

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

module Trailblazer
  module Macro
    # {Macro::Strategy} always keeps a {block_activity} and has to define a `#call` method per macro type.
    class Strategy # We want to look like a real {Linear::Strategy}.
      class << self
        extend Forwardable
        def_delegators :block_activity, :step, :pass, :fail, :Subprocess # TODO: add all DSL::Helper
      end

      # This makes {Wrap} look like {block_activity}.
      def self.to_h
        block_activity.to_h
      end

      def self.block_activity
        @state.get(:block_activity)
      end

      # DISCUSS: move this to Linear::Strategy.
      module State
        def initialize!(state)
          @state = state
        end

        def inherited(inheritor)
          super
          inheritor.initialize!(@state.copy)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trailblazer-macro-2.1.16 lib/trailblazer/macro/strategy.rb