Module: Norman
- Extended by:
- Norman
- Included in:
- Norman
- Defined in:
- lib/norman.rb,
lib/norman/model.rb,
lib/norman/mapper.rb,
lib/norman/adapter.rb,
lib/norman/version.rb,
lib/norman/hash_proxy.rb,
lib/norman/active_model.rb,
lib/norman/adapters/file.rb,
lib/norman/adapters/yaml.rb,
lib/norman/adapters/cookie.rb,
lib/norman/abstract_key_set.rb
Overview
Norman is a database and ORM replacement for small, mostly static models.
Norman is free software released under the terms of the MIT License.
Defined Under Namespace
Modules: ActiveModel, Adapters, Model, Version Classes: AbstractKeySet, Adapter, HashProxy, HashProxySet, KeyIterator, Mapper, NormanError, NotFoundError
Instance Attribute Summary collapse
-
#adapters ⇒ Object
readonly
A hash of all instantiated Norman adapters.
-
#default_adapter_name ⇒ Object
readonly
The default adapter name.
Instance Method Summary collapse
-
#register_adapter(adapter) ⇒ Object
Registers an adapter with Norman.
Instance Attribute Details
#adapters ⇒ Object (readonly)
A hash of all instantiated Norman adapters.
24 25 26 |
# File 'lib/norman.rb', line 24 def adapters @adapters end |
#default_adapter_name ⇒ Object (readonly)
The default adapter name.
20 21 22 |
# File 'lib/norman.rb', line 20 def default_adapter_name @default_adapter_name end |
Instance Method Details
#register_adapter(adapter) ⇒ Object
Registers an adapter with Norman. This facilitates allowing models to specify an adapter by name rather than class or instance.
32 33 34 35 36 37 38 39 40 |
# File 'lib/norman.rb', line 32 def register_adapter(adapter) name = adapter.name.to_sym if adapters[name] raise NormanError, "Adapter #{name.inspect} already registered" end @lock.synchronize do adapters[name] = adapter end end |