Sha256: 04d1e12afbd9081d950216fd0de055429215fe9aaef929b77d784be9b595d9e9

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Logic
    class Rule
      class 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.empty?
            name.to_s
          else
            "#{name}(#{args.map(&:inspect).join(", ")})"
          end
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-1.6.0 lib/dry/logic/rule/predicate.rb
dry-logic-1.5.0 lib/dry/logic/rule/predicate.rb
dry-logic-1.4.0 lib/dry/logic/rule/predicate.rb
dry-logic-1.3.0 lib/dry/logic/rule/predicate.rb