Module: TypeEnforcer
- Defined in:
- lib/type-enforcer/base.rb,
lib/type-enforcer/matchers.rb
Defined Under Namespace
Classes: Error, NotFulfilledError, NotPresentError
Class Method Summary
collapse
Class Method Details
.build_options(options, defaults) ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/type-enforcer/base.rb', line 76
def self.build_options(options, defaults)
if options.is_a?(Array)
options = options.last.is_a?(Hash) ? options.pop : {}
end
defaults.merge(options)
end
|
.raise_or_return(error) ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/type-enforcer/base.rb', line 84
def self.raise_or_return(error)
if error.is_a?(Class) && error <= Exception
raise error
else
error
end
end
|