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.
13 14 15 |
# File 'lib/dry/schema/predicate_registry.rb', line 13 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.
10 11 12 |
# File 'lib/dry/schema/predicate_registry.rb', line 10 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.
18 19 20 |
# File 'lib/dry/schema/predicate_registry.rb', line 18 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.
28 29 30 31 32 33 34 35 |
# File 'lib/dry/schema/predicate_registry.rb', line 28 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.
23 24 25 |
# File 'lib/dry/schema/predicate_registry.rb', line 23 def key?(name) predicates.respond_to?(name) end |