Class: SCSI::Config
- Inherits:
-
Object
- Object
- SCSI::Config
- Defined in:
- lib/scsi/config.rb
Instance Attribute Summary collapse
-
#dump_errors ⇒ Object
Returns the value of attribute dump_errors.
-
#logging ⇒ Object
Returns the value of attribute logging.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
Class Method Summary collapse
-
.load_config(path) ⇒ Object
Load Ruby config file.
-
.setup {|Config.shared| ... } ⇒ Object
Call this from your config file.
-
.shared ⇒ SCSI::Config
Returns the shared instance.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
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_errors ⇒ Object
Returns the value of attribute dump_errors.
27 28 29 |
# File 'lib/scsi/config.rb', line 27 def dump_errors @dump_errors end |
#logging ⇒ Object
Returns the value of attribute logging.
28 29 30 |
# File 'lib/scsi/config.rb', line 28 def logging @logging end |
#tokens ⇒ Object
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
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.(path) SCSI.logger.info('Config.load_config done.') end |
.setup {|Config.shared| ... } ⇒ Object
Call this from your config file
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 |
.shared ⇒ SCSI::Config
Returns the shared instance
16 17 18 |
# File 'lib/scsi/config.rb', line 16 def self.shared @shared_config ||= Config.new end |