lib/chartmogul/config_attributes.rb in chartmogul-ruby-1.1.9 vs lib/chartmogul/config_attributes.rb in chartmogul-ruby-1.2.0
- old
+ new
@@ -1,9 +1,9 @@
module ChartMogul
module ConfigAttributes
- def config_accessor(attribute)
+ def config_accessor(attribute, default_value = nil)
define_method(attribute) do
- attr = config.send(attribute)
+ attr = config.send(attribute) || default_value
raise ConfigurationError, "Configuration for #{attribute} not set" if attr.nil?
attr
end
define_method("#{attribute}=") do |val|