Module: Unveil
- Defined in:
- lib/unveil.rb,
lib/unveil/error.rb,
lib/unveil/version.rb
Defined Under Namespace
Modules: ClassMethods
Classes: UndefinedScopeError
Constant Summary
collapse
- VERSION =
'0.1.5'
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
5
6
7
|
# File 'lib/unveil.rb', line 5
def self.included(base)
base.send :extend, ClassMethods
end
|
Instance Method Details
#unveil(*args) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/unveil.rb', line 20
def unveil(*args)
name = args[0].is_a?(Symbol) ? args.shift : :default
options = args[0] || {}
unless self.class.unveil_scopes[name]
raise Unveil::UndefinedScopeError,
":#{name} hasn't been defined. Try adding `unveil :#{name}` to #{self.class.name}."
end
return serializable_hash(self.class.unveil_scopes[name].merge(options))
end
|