Class: SCSI::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/scsi/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



30
31
32
33
34
# File 'lib/scsi/config.rb', line 30

def initialize
  @tokens = []
  @dump_errors = false
  @logging = false
end

Instance Attribute Details

#dump_errorsObject

Returns the value of attribute dump_errors.



27
28
29
# File 'lib/scsi/config.rb', line 27

def dump_errors
  @dump_errors
end

#loggingObject

Returns the value of attribute logging.



28
29
30
# File 'lib/scsi/config.rb', line 28

def logging
  @logging
end

#tokensObject

Returns the value of attribute tokens.



26
27
28
# File 'lib/scsi/config.rb', line 26

def tokens
  @tokens
end

Class Method Details

.load_config(path) ⇒ Object

Load Ruby config file

Parameters:

  • path (String)

    config file



7
8
9
10
11
12
# File 'lib/scsi/config.rb', line 7

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

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

Call this from your config file

Yields:



21
22
23
24
# File 'lib/scsi/config.rb', line 21

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

.sharedSCSI::Config

Returns the shared instance

Returns:



16
17
18
# File 'lib/scsi/config.rb', line 16

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