module Evostream::Configuration

Constants

DEFAULT_PASSWORD
DEFAULT_PATH_PREFIX
DEFAULT_PORT
DEFAULT_PROTOCOL
DEFAULT_TIMEOUT
DEFAULT_USERNAME
OPTIONAL_CONFIG_KEYS
VALID_CONFIG_KEYS

Public Class Methods

extended(base) click to toggle source

Make sure we have the default values set when we get 'extended'

# File lib/evostream/configuration.rb, line 21
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source

config/initializers/evostream.rb (for instance)

Evostream.configure do |config|

config.host = 'evostream.example.com'
config.protocol = 'http'
config.port = 80
config.path_prefix = '/evo'
config.username = 'evo'
config.password = 'password'

end

elsewhere

client = Evostream::Client.new

# File lib/evostream/configuration.rb, line 49
def configure
  yield self
  true
end
options() click to toggle source
# File lib/evostream/configuration.rb, line 54
def options
  Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
end
reset() click to toggle source
# File lib/evostream/configuration.rb, line 25
def reset
  self.protocol    = DEFAULT_PROTOCOL
  self.port        = DEFAULT_PORT
  self.path_prefix = DEFAULT_PATH_PREFIX
  self.username    = DEFAULT_USERNAME
  self.password    = DEFAULT_PASSWORD
  self.timeout     = DEFAULT_TIMEOUT
end