Sha256: 2e132557405493ee916b2ffbacf34d1ded73da2c6cd948a2937f230bafc41c32

Contents?: true

Size: 445 Bytes

Versions: 6

Compression:

Stored size: 445 Bytes

Contents

# frozen_string_literal: true

require "dry/logic/operations/abstract"

module Dry
  module Logic
    module Operations
      class Unary < Abstract
        attr_reader :rule

        def initialize(*rules, **options)
          super
          @rule = rules.first
        end

        def ast(input = Undefined)
          [type, rule.ast(input)]
        end

        def to_s
          "#{type}(#{rule})"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
dry-logic-1.2.0 lib/dry/logic/operations/unary.rb
dry-logic-1.1.1 lib/dry/logic/operations/unary.rb
dry-logic-1.1.0 lib/dry/logic/operations/unary.rb
dry-logic-1.0.8 lib/dry/logic/operations/unary.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/dry-logic-1.0.7/lib/dry/logic/operations/unary.rb
dry-logic-1.0.7 lib/dry/logic/operations/unary.rb