class StrongerParameters::ArrayConstraint
Attributes
item_constraint[R]
Public Class Methods
new(item_constraint)
click to toggle source
# File lib/stronger_parameters/constraints/array_constraint.rb, line 8 def initialize(item_constraint) @item_constraint = item_constraint end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
StrongerParameters::Constraint#==
# File lib/stronger_parameters/constraints/array_constraint.rb, line 25 def ==(other) super && item_constraint == other.item_constraint end
value(v)
click to toggle source
# File lib/stronger_parameters/constraints/array_constraint.rb, line 12 def value(v) if v.is_a?(Array) return v.map do |item| result = item_constraint.value(item) return result if result.is_a?(InvalidValue) result end end InvalidValue.new(v, "must be an array") end