Class: StrongerParameters::Constraint

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

Instance Method Summary collapse

Instance Method Details

#&(other) ⇒ Object



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

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

#==(other) ⇒ Object



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

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

#requiredObject



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

def required
  RequiredConstraint.new(self)
end

#required?Boolean

Returns:

  • (Boolean)


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

def required?
  false
end

#value(v) ⇒ Object



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

def value(v)
  v
end

#|(other) ⇒ Object



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

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