Class: TryRb::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/tryrb/config.rb

Instance Method Summary collapse

Instance Method Details

#dataObject



13
14
15
# File 'lib/tryrb/config.rb', line 13

def data
  @data ||= load_file
end

#expanded_rc_pathObject



25
26
27
# File 'lib/tryrb/config.rb', line 25

def expanded_rc_path
  File.expand_path('~/.tryrbrc')
end

#expanded_tmp_dirObject



29
30
31
# File 'lib/tryrb/config.rb', line 29

def expanded_tmp_dir
  File.expand_path(tmp_dir)
end

#load_fileObject



17
18
19
20
21
22
23
# File 'lib/tryrb/config.rb', line 17

def load_file
  require 'yaml'
  YAML.load_file(expanded_rc_path)
rescue Errno::ENOENT
  print_red("Please run `tryrb config` to configure.")
  abort
end