Sha256: 77093623073da1bc63ea1457f7f3fe6862024ebc1cb3ff3caf040a97e87acf82

Contents?: true

Size: 587 Bytes

Versions: 6

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.to_s
        end
      end

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

Version data entries

6 entries across 6 versions & 2 rubygems

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