Sha256: cd8e1c4797a9a28da93ba1abd2573c89154f794e0e13358ed23b3a21289b5103

Contents?: true

Size: 417 Bytes

Versions: 11

Compression:

Stored size: 417 Bytes

Contents

module ChartMogul
  module ConfigAttributes
    def config_accessor(attribute, default_value = nil)
      define_method(attribute) do
        attr = config.send(attribute) || default_value
        raise ConfigurationError, "Configuration for #{attribute} not set" if attr.nil?
        attr
      end

      define_method("#{attribute}=") do |val|
        config.send("#{attribute}=", val)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
chartmogul-ruby-1.5.1 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.5.0 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.4.1 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.4.0 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.3.3 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.3.2 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.3.1 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.3.0 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.2.2 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.2.1 lib/chartmogul/config_attributes.rb
chartmogul-ruby-1.2.0 lib/chartmogul/config_attributes.rb