Class: Lita::Config Deprecated
- Inherits:
-
Hash
- Object
- Hash
- Lita::Config
- Defined in:
- lib/lita/config.rb
Overview
Deprecated.
Will be removed in Lita 5.0. Use ConfigurationBuilder instead.
An object that stores various user settings that affect Lita’s behavior.
Class Method Summary collapse
-
.default_config ⇒ Lita::Config
Initializes a new Config object with the default settings.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Get a config key.
-
#[]=(key, value) ⇒ Object
Sets a config key.
-
#finalize ⇒ void
Deeply freezes the object to prevent any further mutation.
-
#method_missing(name, *args) ⇒ Object
Allows keys to be read and written with struct-like syntax.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
Allows keys to be read and written with struct-like syntax.
76 77 78 79 80 81 82 83 |
# File 'lib/lita/config.rb', line 76 def method_missing(name, *args) name_string = name.to_s if name_string.chomp!("=") self[name_string] = args.first else self[name_string] end end |
Class Method Details
.default_config ⇒ Lita::Config
Initializes a new Config object with the default settings.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lita/config.rb', line 8 def default_config new.tap do |c| load_robot_configs(c) c.redis = new load_http_configs(c) c.adapter = new c.handlers = new load_handler_configs(c) end end |
Instance Method Details
#[](key) ⇒ Object
Get a config key.
64 65 66 |
# File 'lib/lita/config.rb', line 64 def [](key) super(key.to_sym) end |
#[]=(key, value) ⇒ Object
Sets a config key.
57 58 59 |
# File 'lib/lita/config.rb', line 57 def []=(key, value) super(key.to_sym, value) end |
#finalize ⇒ void
This method returns an undefined value.
Deeply freezes the object to prevent any further mutation.
71 72 73 |
# File 'lib/lita/config.rb', line 71 def finalize IceNine.deep_freeze!(self) end |