Sha256: c3b4205dbde2d06d920bb50430e259dc67649f1edeb7c80091b915ec9c4530b2

Contents?: true

Size: 372 Bytes

Versions: 4

Compression:

Stored size: 372 Bytes

Contents

require 'dry/logic/operations/unary'
require 'dry/logic/result'

module Dry
  module Logic
    module Operations
      class Negation < Unary
        def type
          :not
        end

        def call(input)
          Result.new(rule.(input).failure?, id) { ast(input) }
        end

        def [](input)
          !rule[input]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-1.0.0 lib/dry/logic/operations/negation.rb
dry-logic-0.6.1 lib/dry/logic/operations/negation.rb
dry-logic-0.6.0 lib/dry/logic/operations/negation.rb
dry-logic-0.5.0 lib/dry/logic/operations/negation.rb