Sha256: b2b4714f9f82b4338b33a31fed9b2ea1ab7d50145865fa28cff5c24abe1bd598

Contents?: true

Size: 947 Bytes

Versions: 3

Compression:

Stored size: 947 Bytes

Contents

# Configuration Class
#
# this allows to you to setup all your configuration
# params through an initializer such as:
#
# config/initializers/add_this.rb
#
# @example
#   AddThis.configure do
#     config.user_id    = "generalthings"
#     config.password   = "password"
#   end

module AddThis

  class Configuration

    # Define the available methods
    attr_accessor :user_id, :password

    def initialize
      @user_id    = "generalthings"
      @password   = "password"
    end
  end

  # Defines configuration method to allow
  # Configuration.new to be stored on the 
  # global object
  class << self
    attr_accessor :configuration
  end

  # Allows you to build a configure block
  #
  # @option options [String] :user_id login to Add This
  # @option options [String] :password password to Add This
  # @return [Boolean]
  def self.configure
    self.configuration ||= Configuration.new
    yield configuration
    true
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
add_this-0.0.3 lib/add_this/configuration.rb
add_this-0.0.2 lib/add_this/configuration.rb
add_this-0.0.1 lib/add_this/configuration.rb