Class: StrongerParameters::AndConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- StrongerParameters::AndConstraint
- Defined in:
- lib/stronger_parameters/constraints.rb
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
Instance Method Summary collapse
- #&(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(*constraints) ⇒ AndConstraint
constructor
A new instance of AndConstraint.
- #value(v) ⇒ Object
Methods inherited from Constraint
Constructor Details
#initialize(*constraints) ⇒ AndConstraint
Returns a new instance of AndConstraint.
56 57 58 |
# File 'lib/stronger_parameters/constraints.rb', line 56 def initialize(*constraints) @constraints = constraints end |
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
54 55 56 |
# File 'lib/stronger_parameters/constraints.rb', line 54 def constraints @constraints end |
Instance Method Details
#&(other) ⇒ Object
67 68 69 70 |
# File 'lib/stronger_parameters/constraints.rb', line 67 def &(other) constraints << other self end |
#==(other) ⇒ Object
72 73 74 |
# File 'lib/stronger_parameters/constraints.rb', line 72 def ==(other) super && constraints == other.constraints end |
#value(v) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/stronger_parameters/constraints.rb', line 60 def value(v) constraints.each do |c| v = c.value(v) end v end |