Sha256: af3b4ef7b2e659700d1c47c8c837ee8d92193909a16bddd4d2c531b9539c0bd6

Contents?: true

Size: 587 Bytes

Versions: 5

Compression:

Stored size: 587 Bytes

Contents

# frozen_string_literal: true

require 'dry/logic/rule'

module Dry
  module Logic
    class Rule::Predicate < Rule
      def self.specialize(arity, curried, base = Predicate)
        super
      end

      def type
        :predicate
      end

      def name
        predicate.name
      end

      def to_s
        if args.size > 0
          "#{name}(#{args.map(&:inspect).join(', ')})"
        else
          "#{name}"
        end
      end

      def ast(input = Undefined)
        [type, [name, args_with_names(input)]]
      end
      alias_method :to_ast, :ast
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dry-logic-1.0.6 lib/dry/logic/rule/predicate.rb
dry-logic-1.0.5 lib/dry/logic/rule/predicate.rb
dry-logic-1.0.4 lib/dry/logic/rule/predicate.rb
dry-logic-1.0.3 lib/dry/logic/rule/predicate.rb
dry-logic-1.0.2 lib/dry/logic/rule/predicate.rb