Module: TypeConstraints
- Defined in:
- lib/type_constraints.rb,
lib/type_constraints/meta.rb,
lib/type_constraints/errors.rb,
lib/type_constraints/version.rb,
lib/type_constraints/registry.rb,
lib/type_constraints/type/default.rb
Defined Under Namespace
Modules: Type Classes: InvalidError, Meta, MissingMetaError, Registry
Constant Summary collapse
- VERSION =
"0.1.5"
Class Attribute Summary collapse
-
.registry ⇒ Object
Returns the value of attribute registry.
Class Method Summary collapse
Class Attribute Details
.registry ⇒ Object
Returns the value of attribute registry.
8 9 10 |
# File 'lib/type_constraints.rb', line 8 def registry @registry end |
Class Method Details
.check!(name, val, level = 1) ⇒ Object
20 21 22 23 |
# File 'lib/type_constraints.rb', line 20 def check!(name, val, level=1) raise MissingMetaError, nil, caller(level) if registry.[name].nil? registry.[name].check!(val, level+1) end |
.check?(name, val) ⇒ Boolean
15 16 17 18 |
# File 'lib/type_constraints.rb', line 15 def check?(name, val) return false if registry.[name].nil? registry.[name].check?(val) end |