Module: Breadboard
- Extended by:
- Breadboard
- Included in:
- Breadboard
- Defined in:
- lib/breadboard/config.rb,
lib/breadboard/breadboard.rb,
lib/breadboard/env_config.rb,
lib/breadboard/environment.rb
Defined Under Namespace
Modules: Config
Instance Method Summary collapse
- #config ⇒ Object
- #configure(&block) ⇒ Object
- #env ⇒ Object
- #reset ⇒ Object
- #service_for(model, environment = nil) ⇒ Object
Instance Method Details
#config ⇒ Object
4 5 6 |
# File 'lib/breadboard/breadboard.rb', line 4 def config Config end |
#configure(&block) ⇒ Object
12 13 14 |
# File 'lib/breadboard/breadboard.rb', line 12 def configure(&block) Config.instance_eval &block end |
#service_for(model, environment = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/breadboard/breadboard.rb', line 16 def service_for(model, environment=nil) environment ||= Config.env.to_s.to_sym rescue :all model_superclass_chain = [model] + model.ancestors model_superclass_chain.each do |klass| klass_symbol = klass.to_s.to_sym site = config.send(klass_symbol).send(environment) || config.send(klass_symbol).send(:all) return site if site end return config.default.send(environment) || config.default.send(:all) end |