Sha256: 4aa737e3f2e412eeeb187c21eaae01937b6b75bdd8904aefd20f72ce16c3d372

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

class Trailblazer::V2_1::Operation
  module Policy
    def self.Guard(proc, name: :default, &block)
      Policy.step( Guard.build(proc), name: name )
    end

    module Guard
      def self.build(callable)
        option = Trailblazer::V2_1::Option::KW(callable)

        # this gets wrapped in a Operation::Result object.
        ->( (options, *), circuit_args ) do
          Result.new(!!option.call(options, circuit_args), {})
        end
      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/operation/guard.rb