Class: Lab42::CheckedClass::Constraint

Inherits:
Object
  • Object
show all
Extended by:
Predefined
Defined in:
lib/lab42/checked_class/constraint.rb,
lib/lab42/checked_class/constraint/predefined.rb

Defined Under Namespace

Modules: Predefined

Instance Method Summary collapse

Methods included from Predefined

bool?, match?, member?

Instance Method Details

#check(subject) ⇒ Object



9
10
11
12
13
14
# File 'lib/lab42/checked_class/constraint.rb', line 9

def check(subject)
 subject = @attr ? subject[@attr] : subject
  return nil if @constraint.(subject)

  @name
end