Module: Saorin::Registerable::ClassMethods
- Defined in:
- lib/saorin/registerable.rb
Instance Attribute Summary collapse
-
#load_path ⇒ Object
Returns the value of attribute load_path.
Instance Method Summary collapse
Instance Attribute Details
#load_path ⇒ Object
Returns the value of attribute load_path.
12 13 14 |
# File 'lib/saorin/registerable.rb', line 12 def load_path @load_path end |
Instance Method Details
#adapters ⇒ Object
14 15 16 |
# File 'lib/saorin/registerable.rb', line 14 def adapters @adapters ||= {} end |
#guess(key) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/saorin/registerable.rb', line 22 def guess(key) key = key.to_s require "#{load_path}/#{key}" adapter = adapters[key] raise AdapterNotFound, key unless adapter adapter end |
#register(key, adapter) ⇒ Object
18 19 20 |
# File 'lib/saorin/registerable.rb', line 18 def register(key, adapter) adapters[key.to_s] = adapter end |