class StrongerParameters::AndConstraint

Attributes

constraints[R]

Public Class Methods

new(*constraints) click to toggle source
# File lib/stronger_parameters/constraint.rb, line 70
def initialize(*constraints)
  @constraints = constraints
end

Public Instance Methods

&(other) click to toggle source
# File lib/stronger_parameters/constraint.rb, line 82
def &(other)
  constraints << other
  self
end
==(other) click to toggle source
Calls superclass method StrongerParameters::Constraint#==
# File lib/stronger_parameters/constraint.rb, line 87
def ==(other)
  super && constraints == other.constraints
end
required?() click to toggle source
# File lib/stronger_parameters/constraint.rb, line 91
def required?
  constraints.any?(&:required?)
end
value(v) click to toggle source
# File lib/stronger_parameters/constraint.rb, line 74
def value(v)
  constraints.each do |c|
    v = c.value(v)
    return v if v.is_a?(InvalidValue)
  end
  v
end