Sha256: 975f7c551debe5cffde1e3399b0226c18a37c869a381afe4d83cbb34d286af1d

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

module GaExampleGem

  # This is the configuration module that 
  # allows us to setup an api_key
  # using a pattern close to the Twitter or MtGox gem
	module Configuration

    # This is our API key. We aren't really using it
    # anywhere, but you could imagine using it
    # with HTTP requests
    # This is tricky, this adds these attr_accessors to the CLASS
		attr_accessor :api_key, :oauth_key

    # This yields a block that can be iterated on
    # Its useful for being able to set values to the
    # attr_accessor
    def configure
      yield self
    end

    # This reset our API key and is called when the 
    # client is initialized
    def reset
      self.api_key = nil
      self
    end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ga_example_gem-0.0.4 lib/ga_example_gem/configuration.rb
ga_example_gem-0.0.3 lib/ga_example_gem/configuration.rb