Module: Trailblazer::Operation::Policy::Guard

Defined in:
lib/trailblazer/operation/guard.rb

Class Method Summary collapse

Class Method Details

.build(callable) ⇒ Object



10
11
12
13
14
15
# File 'lib/trailblazer/operation/guard.rb', line 10

def self.build(callable)
  value = Option::KW.(callable) # Operation::Option

  # this gets wrapped in a Operation::Result object.
  ->(input, options) { Result.new( !!value.(input, options), {} ) }
end