Module: Registerable
- Defined in:
- lib/mixers/registerable.rb
Overview
Registerable
Instance Method Summary collapse
-
#register(obj, *names) ⇒ Object
Register format names.
-
#registry ⇒ Object
Access registry.
- #registry_invalid?(*types) ⇒ Boolean
Instance Method Details
#register(obj, *names) ⇒ Object
Register format names.
7 8 9 10 11 |
# File 'lib/mixers/registerable.rb', line 7 def register(obj, *names) names.each do |name| registry[name] = obj end end |
#registry ⇒ Object
Access registry.
15 16 17 |
# File 'lib/mixers/registerable.rb', line 15 def registry @@registry ||= {} end |
#registry_invalid?(*types) ⇒ Boolean
21 22 23 24 25 26 27 |
# File 'lib/mixers/registerable.rb', line 21 def registry_invalid?(*types) bad = [] types.each do |type| bad << type unless @@registry[type] end return bad.empty? ? false : bad end |