Class: TryRb::Config
Constant Summary collapse
- FILE_NAME =
'.tryrbrc'
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load_file ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 18 |
# File 'lib/tryrb/config.rb', line 15 def initialize @path = File.join(File.('~'), FILE_NAME) @data = load_file end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/tryrb/config.rb', line 6 def path @path end |
Instance Method Details
#load_file ⇒ Object
26 27 28 29 30 31 |
# File 'lib/tryrb/config.rb', line 26 def load_file require 'yaml' YAML.load_file(@path) rescue Errno::ENOENT default_config end |