Class: StrongerParameters::Constraint

Inherits:
Object
  • Object
show all
Defined in:
lib/stronger_parameters/constraint.rb

Instance Method Summary collapse

Instance Method Details

#&(other) ⇒ Object



15
16
17
# File 'lib/stronger_parameters/constraint.rb', line 15

def &(other)
  AndConstraint.new(self, other)
end

#==(other) ⇒ Object



19
20
21
# File 'lib/stronger_parameters/constraint.rb', line 19

def ==(other)
  self.class == other.class
end

#requiredObject



23
24
25
# File 'lib/stronger_parameters/constraint.rb', line 23

def required
  RequiredConstraint.new(self)
end

#required?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/stronger_parameters/constraint.rb', line 27

def required?
  false
end

#value(v) ⇒ Object



7
8
9
# File 'lib/stronger_parameters/constraint.rb', line 7

def value(v)
  v
end

#|(other) ⇒ Object



11
12
13
# File 'lib/stronger_parameters/constraint.rb', line 11

def |(other)
  OrConstraint.new(self, other)
end