lib/dry/validation/rule.rb in dry-validation-1.0.0.beta2 vs lib/dry/validation/rule.rb in dry-validation-1.0.0.rc1
- old
+ new
@@ -7,11 +7,11 @@
module Validation
# Rules are created by contracts
#
# @api private
class Rule
- include Dry::Equalizer(:name, :block)
+ include Dry::Equalizer(:keys, :block, inspect: false)
extend Dry::Initializer
# @!atrribute [r] keys
# @return [Array<Symbol, String, Hash>]
@@ -30,9 +30,18 @@
# @param [Concurrent::Map] context
#
# @api private
def call(contract, result, context)
Evaluator.new(contract, values: result, keys: keys, _context: context, &block)
+ end
+
+ # Return a nice string representation
+ #
+ # @return [String]
+ #
+ # @api public
+ def inspect
+ %(#<#{self.class} keys=#{keys.inspect}>)
end
end
end
end