Class: Config
- Inherits:
-
Object
- Object
- Config
- Extended by:
- Dry::Container::Mixin
- Includes:
- Singleton
- Defined in:
- lib/rforward/config.rb
Constant Summary collapse
- FLUENTD =
:flunetd.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#root_path ⇒ Object
Returns the value of attribute root_path.
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/rforward/config.rb', line 4 def config @config end |
#root_path ⇒ Object
Returns the value of attribute root_path.
5 6 7 |
# File 'lib/rforward/config.rb', line 5 def root_path @root_path end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 16 |
# File 'lib/rforward/config.rb', line 13 def [](key) config = @config || sample config[key.to_s] end |
#create_sample_config(config_path) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rforward/config.rb', line 18 def create_sample_config config_path RLogger.instance.info "Config created (#{config_path})" File.open(config_path,"w") do |file| file.write sample.to_yaml end end |
#load_config(config_path) ⇒ Object
9 10 11 |
# File 'lib/rforward/config.rb', line 9 def load_config config_path @config = YAML.load_file config_path end |