Class: Dry::Schema::PredicateRegistry Private
- Inherits:
-
Object
- Object
- Dry::Schema::PredicateRegistry
- Defined in:
- lib/dry/schema/predicate_registry.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A registry with predicate objects from ‘Dry::Logic::Predicates`
Instance Attribute Summary collapse
- #predicates ⇒ Object readonly private
Instance Method Summary collapse
- #[](name) ⇒ Object private
- #arg_list(name, *values) ⇒ Object private
-
#initialize(predicates = Dry::Logic::Predicates) ⇒ PredicateRegistry
constructor
private
A new instance of PredicateRegistry.
- #key?(name) ⇒ Boolean private
Constructor Details
#initialize(predicates = Dry::Logic::Predicates) ⇒ PredicateRegistry
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PredicateRegistry.
15 16 17 |
# File 'lib/dry/schema/predicate_registry.rb', line 15 def initialize(predicates = Dry::Logic::Predicates) @predicates = predicates end |
Instance Attribute Details
#predicates ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/dry/schema/predicate_registry.rb', line 12 def predicates @predicates end |
Instance Method Details
#[](name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/dry/schema/predicate_registry.rb', line 20 def [](name) predicates[name] end |
#arg_list(name, *values) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 |
# File 'lib/dry/schema/predicate_registry.rb', line 30 def arg_list(name, *values) predicate = self[name] predicate .parameters .map(&:last) .zip(values + Array.new(predicate.arity - values.size, Undefined)) end |
#key?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/dry/schema/predicate_registry.rb', line 25 def key?(name) predicates.respond_to?(name) end |