Class: Redis::Stream::Config
- Inherits:
-
Object
- Object
- Redis::Stream::Config
- Defined in:
- lib/redis/stream/config.rb
Overview
Simple way to read and manage a config.yml file
Class Method Summary collapse
-
.[](key) ⇒ Object
get the value for a key.
-
.[]=(key, value) ⇒ Object
set a value into the config.yml file.
-
.include?(key) ⇒ Boolean
is key available in config store.
-
.name ⇒ String
get name of config file.
-
.name=(config_file_name) ⇒ Object
set config file name defaults to config.yml.
-
.path ⇒ String
return the current location of the config.yml file.
-
.path=(config_file_path) ⇒ Object
set path to config file.
Class Method Details
.[](key) ⇒ Object
get the value for a key
38 39 40 41 |
# File 'lib/redis/stream/config.rb', line 38 def self.[](key) init @config[key] end |
.[]=(key, value) ⇒ Object
set a value into the config.yml file
47 48 49 50 51 52 53 |
# File 'lib/redis/stream/config.rb', line 47 def self.[]=(key, value) init @config[key] = value File.open("#{path}/#{name}", 'w') do |f| f.puts @config.to_yaml end end |
.include?(key) ⇒ Boolean
is key available in config store
58 59 60 61 |
# File 'lib/redis/stream/config.rb', line 58 def self.include?(key) init @config.include?(key) end |
.name ⇒ String
get name of config file
13 14 15 |
# File 'lib/redis/stream/config.rb', line 13 def self.name @config_file_name end |
.name=(config_file_name) ⇒ Object
set config file name defaults to config.yml
19 20 21 |
# File 'lib/redis/stream/config.rb', line 19 def self.name=(config_file_name) @config_file_name = config_file_name end |
.path ⇒ String
return the current location of the config.yml file
25 26 27 |
# File 'lib/redis/stream/config.rb', line 25 def self.path @config_file_path end |
.path=(config_file_path) ⇒ Object
set path to config file
31 32 33 |
# File 'lib/redis/stream/config.rb', line 31 def self.path=(config_file_path) @config_file_path = config_file_path end |