Class: SubscribedTo::MailChimp::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/subscribed_to/mail_chimp/config.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Config

Returns a new instance of Config.



22
23
24
25
26
27
28
# File 'lib/subscribed_to/mail_chimp/config.rb', line 22

def initialize(config = {})
  merge!(config)
  self[:api_key]        ||= nil
  self[:lists]          ||= {}
  self[:secret_key]     ||= "J/M7k+j8zBJI7SM5"
  self[:enabled_models] ||= {}
end

Class Method Details

.hash_accessor(*names) ⇒ Object

Creates an accessor that simply sets and reads a key in the hash: Borrowed from Warden: github.com/hassox/warden/blob/master/lib/warden/config.rb



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/subscribed_to/mail_chimp/config.rb', line 6

def self.hash_accessor(*names) #:nodoc:
  names.each do |name|
    class_eval <<-METHOD, __FILE__, __LINE__ + 1
      def #{name}
        self[:#{name}]
      end

      def #{name}=(value)
        self[:#{name}] = value
      end
    METHOD
  end
end