Class: MosEisley::Config
- Inherits:
-
Object
- Object
- MosEisley::Config
- Defined in:
- lib/mos-eisley/config.rb
Instance Attribute Summary collapse
-
#bot_access_token ⇒ Object
Returns the value of attribute bot_access_token.
-
#dump_errors ⇒ Object
Returns the value of attribute dump_errors.
-
#handler_paths ⇒ Object
Returns the value of attribute handler_paths.
-
#logging ⇒ Object
Returns the value of attribute logging.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#public_folder ⇒ Object
Returns the value of attribute public_folder.
-
#user ⇒ Object
Returns the value of attribute user.
-
#verification_token ⇒ Object
Returns the value of attribute verification_token.
Class Method Summary collapse
-
.load_config(path) ⇒ Object
Load Ruby config file.
-
.setup {|Config.shared| ... } ⇒ Object
Call this from your config file.
-
.shared ⇒ MosEisley::Config
Returns the shared instance.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #run_post_boot ⇒ Object
- #set_post_boot(&block) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mos-eisley/config.rb', line 40 def initialize @handler_paths = [] @dump_errors = false @logging = false @meta = {} @verification_token = nil @bot_access_token = '' end |
Instance Attribute Details
#bot_access_token ⇒ Object
Returns the value of attribute bot_access_token.
38 39 40 |
# File 'lib/mos-eisley/config.rb', line 38 def bot_access_token @bot_access_token end |
#dump_errors ⇒ Object
Returns the value of attribute dump_errors.
32 33 34 |
# File 'lib/mos-eisley/config.rb', line 32 def dump_errors @dump_errors end |
#handler_paths ⇒ Object
Returns the value of attribute handler_paths.
30 31 32 |
# File 'lib/mos-eisley/config.rb', line 30 def handler_paths @handler_paths end |
#logging ⇒ Object
Returns the value of attribute logging.
33 34 35 |
# File 'lib/mos-eisley/config.rb', line 33 def logging @logging end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
35 36 37 |
# File 'lib/mos-eisley/config.rb', line 35 def @meta end |
#public_folder ⇒ Object
Returns the value of attribute public_folder.
31 32 33 |
# File 'lib/mos-eisley/config.rb', line 31 def public_folder @public_folder end |
#user ⇒ Object
Returns the value of attribute user.
29 30 31 |
# File 'lib/mos-eisley/config.rb', line 29 def user @user end |
#verification_token ⇒ Object
Returns the value of attribute verification_token.
37 38 39 |
# File 'lib/mos-eisley/config.rb', line 37 def verification_token @verification_token end |
Class Method Details
.load_config(path) ⇒ Object
Load Ruby config file
11 12 13 14 15 |
# File 'lib/mos-eisley/config.rb', line 11 def self.load_config(path) MosEisley.logger.debug("Loading config file: #{path}") require File.(path) MosEisley.logger.info('Config.load_config done.') end |
.setup {|Config.shared| ... } ⇒ Object
Call this from your config file
24 25 26 27 |
# File 'lib/mos-eisley/config.rb', line 24 def self.setup yield Config.shared MosEisley.logger.debug('Config.setup block executed.') end |
.shared ⇒ MosEisley::Config
Returns the shared instance
19 20 21 |
# File 'lib/mos-eisley/config.rb', line 19 def self.shared @shared_config ||= Config.new end |
Instance Method Details
#run_post_boot ⇒ Object
55 56 57 58 |
# File 'lib/mos-eisley/config.rb', line 55 def run_post_boot @post_boot_block.call if @post_boot_block @post_boot_block = nil end |
#set_post_boot(&block) ⇒ Object
51 52 53 |
# File 'lib/mos-eisley/config.rb', line 51 def set_post_boot(&block) @post_boot_block = block end |