Class: Minjector::Config
- Inherits:
-
Object
- Object
- Minjector::Config
- Defined in:
- lib/minjector/config.rb
Class Method Summary collapse
Class Method Details
.exists? ⇒ Boolean
26 27 28 |
# File 'lib/minjector/config.rb', line 26 def exists? File.exist?(file) end |
.file ⇒ Object
8 9 10 |
# File 'lib/minjector/config.rb', line 8 def file File.(File.join("~", ".minjector", "config")) end |
.read ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/minjector/config.rb', line 12 def read config = {} File.open(file, "r") do |f| config = YAML.load(f) end config[:buckets].each do |bucket| bucket[:path] = File.(bucket[:path]) end config end |
.write(config) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/minjector/config.rb', line 30 def write(config) unless exists? FileUtils.mkdir_p(File.dirname(file)) end File.open(file, "w") do |f| return YAML.dump(config, f) end end |