lib/runcible/base.rb in runcible-0.4.8 vs lib/runcible/base.rb in runcible-0.4.9

- old
+ new

@@ -46,13 +46,17 @@ :headers => {:content_type => 'application/json', :accept => 'application/json'}, :logging => {} }.merge(conf) end - - def self.config - @@config + + def self.config + if defined?(@@config) + @@config + else + raise Runcible::ConfigurationUndefinedError, Runcible::ConfigurationUndefinedError.message + end end def self.call(method, path, options={}) clone_config = self.config.clone #on occation path will already have prefix (sync cancel) @@ -207,6 +211,14 @@ def self.generate_log_message RestClient.log.join('\n') end end + + class ConfigurationUndefinedError < StandardError + + def self.message + # override me to change the error message + "Configuration not set. Runcible::Base.config= must be called before Runcible::Base.config." + end + end end