Class: PINS::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/postmark-inbound/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



36
37
38
39
40
41
# File 'lib/postmark-inbound/config.rb', line 36

def initialize
  @passwords = []
  @handler_paths = []
  @dump_errors = false
  @logging = false
end

Instance Attribute Details

#dump_errorsObject

Returns the value of attribute dump_errors.



33
34
35
# File 'lib/postmark-inbound/config.rb', line 33

def dump_errors
  @dump_errors
end

#handler_pathsObject

Returns the value of attribute handler_paths.



32
33
34
# File 'lib/postmark-inbound/config.rb', line 32

def handler_paths
  @handler_paths
end

#loggingObject

Returns the value of attribute logging.



34
35
36
# File 'lib/postmark-inbound/config.rb', line 34

def logging
  @logging
end

#passwordsObject

Returns the value of attribute passwords.



31
32
33
# File 'lib/postmark-inbound/config.rb', line 31

def passwords
  @passwords
end

#userObject

Returns the value of attribute user.



30
31
32
# File 'lib/postmark-inbound/config.rb', line 30

def user
  @user
end

Class Method Details

.load_config(path) ⇒ Object

Load Ruby config file

Parameters:

  • path (String)

    config file



11
12
13
14
15
16
# File 'lib/postmark-inbound/config.rb', line 11

def self.load_config(path)
  raise 'config file missing' unless path
  PINS.logger.debug("Loading config file: #{path}")
  require File.expand_path(path)
  PINS.logger.info('Config.load_config done.')
end

.setup {|Config.shared| ... } ⇒ Object

Call this from your config file

Yields:



25
26
27
28
# File 'lib/postmark-inbound/config.rb', line 25

def self.setup
  yield Config.shared
  PINS.logger.debug('Config.setup block executed.')
end

.sharedPINS::Config

Returns the shared instance

Returns:



20
21
22
# File 'lib/postmark-inbound/config.rb', line 20

def self.shared
  @shared_config ||= Config.new
end