Class: Lotus::Validations::ValidationSet Private
- Inherits:
-
Object
- Object
- Lotus::Validations::ValidationSet
- Defined in:
- lib/lotus/validations/validation_set.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 set of validations defined on an object
Constant Summary collapse
- VALIDATIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Allowed validations
[ :presence, :acceptance, :format, :inclusion, :exclusion, :confirmation, :size, :type, :nested ].freeze
Instance Method Summary collapse
- #add(name, options) ⇒ Object private
- #each(&blk) ⇒ Object private
- #each_key(&blk) ⇒ Object private
-
#initialize ⇒ ValidationSet
constructor
private
A new instance of ValidationSet.
- #names ⇒ Object private
Constructor Details
#initialize ⇒ ValidationSet
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 ValidationSet.
26 27 28 |
# File 'lib/lotus/validations/validation_set.rb', line 26 def initialize @validations = Hash.new {|h,k| h[k] = {} } end |
Instance Method Details
#add(name, options) ⇒ 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.
32 33 34 35 36 |
# File 'lib/lotus/validations/validation_set.rb', line 32 def add(name, ) @validations[name.to_sym].merge!( (name, ) ) end |
#each(&blk) ⇒ 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.
40 41 42 |
# File 'lib/lotus/validations/validation_set.rb', line 40 def each(&blk) @validations.each(&blk) end |
#each_key(&blk) ⇒ 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.
46 47 48 |
# File 'lib/lotus/validations/validation_set.rb', line 46 def each_key(&blk) @validations.each_key(&blk) end |
#names ⇒ 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.
52 53 54 |
# File 'lib/lotus/validations/validation_set.rb', line 52 def names @validations.keys end |