Class: Klipbook::Config
- Inherits:
-
Object
- Object
- Klipbook::Config
- Defined in:
- lib/klipbook/config.rb
Instance Method Summary collapse
-
#initialize(config_file_name = '.klipbookrc') ⇒ Config
constructor
A new instance of Config.
- #merge_config_from_rc_file(config) ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(config_file_name = '.klipbookrc') ⇒ Config
Returns a new instance of Config.
3 4 5 |
# File 'lib/klipbook/config.rb', line 3 def initialize(config_file_name='.klipbookrc') @config_file_name = config_file_name end |
Instance Method Details
#merge_config_from_rc_file(config) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/klipbook/config.rb', line 11 def merge_config_from_rc_file(config) config_file = File.join(File.(ENV['HOME']), @config_file_name) if config_file && File.exist?(config_file) require 'yaml' config.merge!(File.open(config_file) { |file| YAML::load(file) }) end config end |
#read ⇒ Object
7 8 9 |
# File 'lib/klipbook/config.rb', line 7 def read merge_config_from_rc_file({}) end |