Class: Attestor::Validations::Validators Private
- Inherits:
-
Object
- Object
- Attestor::Validations::Validators
- Includes:
- Enumerable
- Defined in:
- lib/attestor/validations/validators.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.
The collection of validations used by class instances
Class Method Summary collapse
-
.add_follower(*args) ⇒ Attestor::Validators
private
Returns validators updated by a new follower with given args.
-
.add_validator(*args) ⇒ Attestor::Validators
private
Returns validators updated by a new validator with given args.
-
.each {|item| ... } ⇒ Enumerator
private
Iterates through the collection.
- .initialize(*items) ⇒ Object private
-
.new(items = []) ⇒ Attestor::Validators
Creates an immutable collection with optional list of items.
-
.set(context) ⇒ Attestor::Validators
private
Returns validators used in given context.
Class Method Details
.add_follower(*args) ⇒ Attestor::Validators
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 validators updated by a new follower with given args
62 63 64 |
# File 'lib/attestor/validations/validators.rb', line 62 def add_follower(*args) add_item Follower, *args end |
.add_validator(*args) ⇒ Attestor::Validators
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 validators updated by a new validator with given args
53 54 55 |
# File 'lib/attestor/validations/validators.rb', line 53 def add_validator(*args) add_item Validator, *args end |
.each {|item| ... } ⇒ Enumerator
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.
Iterates through the collection
34 35 36 |
# File 'lib/attestor/validations/validators.rb', line 34 def each block_given? ? items.each { |item| yield(item) } : to_enum end |
.initialize(*items) ⇒ 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.
22 23 24 25 |
# File 'lib/attestor/validations/validators.rb', line 22 def initialize(*items) @items = items.flatten freeze end |
.new(items = []) ⇒ Attestor::Validators
Creates an immutable collection with optional list of items
|
|
# File 'lib/attestor/validations/validators.rb', line 13
|
.set(context) ⇒ Attestor::Validators
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 validators used in given context
43 44 45 46 |
# File 'lib/attestor/validations/validators.rb', line 43 def set(context) validators = select { |item| item.used_in_context? context } (validators == items) ? self : self.class.new(validators) end |