Module: Reindeer::Role::TypeConstraint

Includes:
Reindeer::Role
Defined in:
lib/reindeer/role/typeconstraint.rb

Instance Method Summary collapse

Methods included from Reindeer::Role

included

Instance Method Details

#check_constraint(v) ⇒ Object



5
6
7
# File 'lib/reindeer/role/typeconstraint.rb', line 5

def check_constraint(v)
  raise Reindeer::TypeConstraint::Invalid, error_message_for(v) unless verify(v)
end

#error_message_for(v) ⇒ Object



9
10
11
# File 'lib/reindeer/role/typeconstraint.rb', line 9

def error_message_for(v)
  return "The value '%s' not considered valid by %s" % [v, self.class]
end