Sha256: bfc0f3fd5e49619100473d2fef77f2ad662bf209134094a90b46a40a71f38d08

Contents?: true

Size: 414 Bytes

Versions: 7

Compression:

Stored size: 414 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
dry-logic-1.0.0 lib/dry/logic/operations/unary.rb
dry-logic-0.6.1 lib/dry/logic/operations/unary.rb
dry-logic-0.6.0 lib/dry/logic/operations/unary.rb
dry-logic-0.5.0 lib/dry/logic/operations/unary.rb
dry-logic-0.4.2 lib/dry/logic/operations/unary.rb
dry-logic-0.4.1 lib/dry/logic/operations/unary.rb
dry-logic-0.4.0 lib/dry/logic/operations/unary.rb