Sha256: 24dd307451172b0234c26ab8faf6261a0fa4b122edc21562cb8bf361b93e49c6

Contents?: true

Size: 460 Bytes

Versions: 7

Compression:

Stored size: 460 Bytes

Contents

class Trailblazer::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::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

7 entries across 7 versions & 1 rubygems

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