class StrongerParameters::OrConstraint
Attributes
constraints[R]
Public Class Methods
new(*constraints)
click to toggle source
# File lib/stronger_parameters/constraint.rb, line 34 def initialize(*constraints) @constraints = constraints end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
StrongerParameters::Constraint#==
# File lib/stronger_parameters/constraint.rb, line 58 def ==(other) super && constraints == other.constraints end
required?()
click to toggle source
# File lib/stronger_parameters/constraint.rb, line 62 def required? constraints.all?(&:required?) end
value(v)
click to toggle source
# File lib/stronger_parameters/constraint.rb, line 38 def value(v) exception = nil constraints.each do |c| result = c.value(v) if result.is_a?(InvalidValue) exception ||= result else return result end end exception end
|(other)
click to toggle source
# File lib/stronger_parameters/constraint.rb, line 53 def |(other) constraints << other self end