Class: Reform::Validation::Groups
- Inherits:
-
Array
- Object
- Array
- Reform::Validation::Groups
- Defined in:
- lib/reform/validation/groups.rb
Overview
Set of Validation::Group objects. This implements adding, iterating, and finding groups, including “inheritance” and insertions.
Defined Under Namespace
Classes: Validate
Instance Method Summary collapse
- #add(name, options) ⇒ Object
-
#initialize(group_class) ⇒ Groups
constructor
A new instance of Groups.
Constructor Details
#initialize(group_class) ⇒ Groups
Returns a new instance of Groups.
11 12 13 |
# File 'lib/reform/validation/groups.rb', line 11 def initialize(group_class) @group_class = group_class end |
Instance Method Details
#add(name, options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/reform/validation/groups.rb', line 15 def add(name, ) if [:inherit] return self[name] if self[name] end i = index_for() self.insert(i, [name, group = @group_class.new(), ]) # Group.new group end |