class Atlas::Configuration

Configuration handling for Atlas.

Attributes

token[RW]

Access token for Atlas

Public Class Methods

new(opts = {}) click to toggle source

Create a new Configuration instance

This also allows providing a hash of configuration values, which calls the accessor methods to full in the values.

# File lib/atlas/configuration.rb, line 11
def initialize(opts = {})
  opts.each do |key, value|
    if key.eql?(:access_token)
      key = "token"
      warn "WARNING: Setting the `:access_token` option is " \
           "deprecated, use `:token` instead"
    end

    send("#{key}=".to_sym, value)
  end
end

Public Instance Methods

access_token=(access_token) click to toggle source
# File lib/atlas/configuration.rb, line 34
def access_token=(access_token)
  warn "WARNING: Setting the `:access_token` option is " \
       "deprecated, use `:token` instead"

  @token = access_token
end
to_h() click to toggle source

Hash representation of the configuration object.

# File lib/atlas/configuration.rb, line 24
def to_h
  { token: @token }
end
to_s() click to toggle source

String representation of the configuration.

# File lib/atlas/configuration.rb, line 29
def to_s
  objects = to_h.collect { |k, v| "#{k}=#{v}" }.join(' ')
  "#<#{self.class.name}:#{object_id} #{objects}"
end