Sha256: 449ab21f7b392d06df0bf4ff7cf1edbc5426478439e35dd82a87d8dc58f17597

Contents?: true

Size: 404 Bytes

Versions: 4

Compression:

Stored size: 404 Bytes

Contents

# frozen_string_literal: true

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

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-1.6.0 lib/dry/logic/operations/unary.rb
dry-logic-1.5.0 lib/dry/logic/operations/unary.rb
dry-logic-1.4.0 lib/dry/logic/operations/unary.rb
dry-logic-1.3.0 lib/dry/logic/operations/unary.rb