Module: Ladder::Config
Constant Summary collapse
- LOCK =
Mutex.new
Instance Method Summary collapse
-
#load_configuration(settings) ⇒ Object
From a hash of settings, load all the configuration.
-
#models ⇒ Array<Class>
Get all the models in the application - this is everything that includes Ladder::Resource or Ladder::File.
-
#options=(options) ⇒ Object
Set the configuration options.
-
#register_model(klass) ⇒ Object
Register a model in the application with Ladder.
Instance Method Details
#load_configuration(settings) ⇒ Object
From a hash of settings, load all the configuration.
51 52 53 54 |
# File 'lib/ladder/config.rb', line 51 def load_configuration(settings) configuration = settings.with_indifferent_access self. = configuration[:options] end |
#models ⇒ Array<Class>
Get all the models in the application - this is everything that includes Ladder::Resource or Ladder::File.
25 26 27 |
# File 'lib/ladder/config.rb', line 25 def models @models ||= [] end |
#options=(options) ⇒ Object
Set the configuration options. Will validate each one individually.
64 65 66 67 68 69 70 71 |
# File 'lib/ladder/config.rb', line 64 def () if .each_pair do |option, value| ::Mongoid::Config::Validators::Option.validate(option) send("#{option}=", value) end end end |
#register_model(klass) ⇒ Object
Register a model in the application with Ladder.
37 38 39 40 41 |
# File 'lib/ladder/config.rb', line 37 def register_model(klass) LOCK.synchronize do models.push(klass) unless models.include?(klass) end end |