class Softcover::BaseConfig

Constants

DEFAULTS
PATH

Public Class Methods

[](key) click to toggle source
# File lib/softcover/config.rb, line 11
def [](key)
  store.transaction do
    store[key]
  end || DEFAULTS[key.to_sym]
end
[]=(key, value) click to toggle source
# File lib/softcover/config.rb, line 17
def []=(key, value)
  store.transaction do
    store[key] = value
  end
end
exists?() click to toggle source
# File lib/softcover/config.rb, line 31
def exists?
  File.exists?(file_path)
end
read() click to toggle source
# File lib/softcover/config.rb, line 23
def read
  puts `cat #{file_path}`
end
remove() click to toggle source
# File lib/softcover/config.rb, line 27
def remove
  File.delete(file_path) if exists?
end

Protected Class Methods

file_path() click to toggle source
# File lib/softcover/config.rb, line 43
def file_path
  File.expand_path(path).tap do |full_path|
    full_path.gsub!(/$/,"-test") if Softcover::test?
  end
end
store() click to toggle source
# File lib/softcover/config.rb, line 36
def store
  require 'yaml/store'
  @store ||= begin
     YAML::Store.new(file_path)
  end
end