Class: FactorySeeder::Configuration
- Inherits:
-
Object
- Object
- FactorySeeder::Configuration
- Defined in:
- lib/factory_seeder/configuration.rb
Instance Attribute Summary collapse
-
#default_count ⇒ Object
Returns the value of attribute default_count.
-
#default_strategy ⇒ Object
Returns the value of attribute default_strategy.
-
#environments ⇒ Object
Returns the value of attribute environments.
-
#factory_paths ⇒ Object
Returns the value of attribute factory_paths.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #default_count_for_environment ⇒ Object
- #default_strategy_for_environment ⇒ Object
- #environment_settings ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/factory_seeder/configuration.rb', line 7 def initialize @factory_paths = [] @default_count = 1 @default_strategy = :create @verbose = false @environments = { development: { default_count: 10 }, test: { default_count: 5 }, production: { default_count: 1 } } end |
Instance Attribute Details
#default_count ⇒ Object
Returns the value of attribute default_count.
5 6 7 |
# File 'lib/factory_seeder/configuration.rb', line 5 def default_count @default_count end |
#default_strategy ⇒ Object
Returns the value of attribute default_strategy.
5 6 7 |
# File 'lib/factory_seeder/configuration.rb', line 5 def default_strategy @default_strategy end |
#environments ⇒ Object
Returns the value of attribute environments.
5 6 7 |
# File 'lib/factory_seeder/configuration.rb', line 5 def environments @environments end |
#factory_paths ⇒ Object
Returns the value of attribute factory_paths.
5 6 7 |
# File 'lib/factory_seeder/configuration.rb', line 5 def factory_paths @factory_paths end |
#verbose ⇒ Object
Returns the value of attribute verbose.
5 6 7 |
# File 'lib/factory_seeder/configuration.rb', line 5 def verbose @verbose end |
Instance Method Details
#default_count_for_environment ⇒ Object
24 25 26 |
# File 'lib/factory_seeder/configuration.rb', line 24 def default_count_for_environment environment_settings[:default_count] || @default_count end |
#default_strategy_for_environment ⇒ Object
28 29 30 |
# File 'lib/factory_seeder/configuration.rb', line 28 def default_strategy_for_environment environment_settings[:default_strategy] || @default_strategy end |
#environment_settings ⇒ Object
19 20 21 22 |
# File 'lib/factory_seeder/configuration.rb', line 19 def environment_settings current_env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' @environments[current_env.to_sym] || @environments[:development] end |