Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/factory_hero/configuration.rb
Instance Attribute Summary collapse
-
#factories ⇒ Object
readonly
Returns the value of attribute factories.
Instance Method Summary collapse
- #clear! ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_factory(symbol) ⇒ Object
- #register_factory(factory) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 |
# File 'lib/factory_hero/configuration.rb', line 5 def initialize @factories = {} end |
Instance Attribute Details
#factories ⇒ Object (readonly)
Returns the value of attribute factories.
3 4 5 |
# File 'lib/factory_hero/configuration.rb', line 3 def factories @factories end |
Instance Method Details
#clear! ⇒ Object
21 22 23 |
# File 'lib/factory_hero/configuration.rb', line 21 def clear! factories.clear end |
#load_factory(symbol) ⇒ Object
15 16 17 18 19 |
# File 'lib/factory_hero/configuration.rb', line 15 def load_factory symbol factories.fetch(symbol) do |symbol| undefined_factory_exception symbol end end |
#register_factory(factory) ⇒ Object
9 10 11 12 13 |
# File 'lib/factory_hero/configuration.rb', line 9 def register_factory factory raise_if_exists factory.symbol factories[factory.symbol] = factory end |