Sha256: 1ddedfd1841efa9623d4e72261072bd78dada526be670bc4189dc09b71156f9a

Contents?: true

Size: 570 Bytes

Versions: 8

Compression:

Stored size: 570 Bytes

Contents

module Trailblazer
  class Operation
    class DeprecatedOptions < Option
      def self.call!(proc, direction, options, flow_options, *args)
        if proc.is_a?(Proc) && proc.arity == 1
          deprecate(proc)
          proc.(options)
        elsif proc.method(:call).arity == 1
          deprecate(proc)
          proc.(options)
        else
          super
        end
      end

      def self.deprecate(proc)
        warn "[Trailblazer] Please use the step API `def my_step!(options, **)` for your step: #{proc}"
      end
    end # DeprecatedOptions
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trailblazer-2.1.0.rc1 lib/trailblazer/operation/deprecations.rb
trailblazer-2.1.0.beta7 lib/trailblazer/operation/deprecations.rb
trailblazer-2.1.0.beta6 lib/trailblazer/operation/deprecations.rb
trailblazer-2.1.0.beta5 lib/trailblazer/operation/deprecations.rb
trailblazer-2.1.0.beta4 lib/trailblazer/operation/deprecations.rb
trailblazer-2.1.0.beta3 lib/trailblazer/operation/deprecations.rb
trailblazer-2.1.0.beta2 lib/trailblazer/operation/deprecations.rb
trailblazer-2.1.0.beta1 lib/trailblazer/operation/deprecations.rb