class NewlineHw::Config

Constants

CONFIG_PATH
DEFAULTS

Public Class Methods

install_default() click to toggle source
# File lib/newline_hw/config.rb, line 48
def self.install_default
  File.open(CONFIG_PATH, "w+") do |f|
    f.write DEFAULTS.to_yaml
  end
end

Public Instance Methods

config() click to toggle source
# File lib/newline_hw/config.rb, line 18
def config
  @config ||= DEFAULTS.merge(config_file)
end
config_file() click to toggle source
# File lib/newline_hw/config.rb, line 22
def config_file
  YAML.load_file(CONFIG_PATH) || DEFAULTS
rescue Errno::ENOENT
  DEFAULTS
end
editor() click to toggle source
# File lib/newline_hw/config.rb, line 28
def editor
  config["editor"]
end
homework_dir() click to toggle source
# File lib/newline_hw/config.rb, line 40
def homework_dir
  config["homework_dir"]
end
launch_editor() click to toggle source
# File lib/newline_hw/config.rb, line 44
def launch_editor
  config["launch_editor"]
end
log_file() click to toggle source
# File lib/newline_hw/config.rb, line 36
def log_file
  config["log_file"]
end
terminal() click to toggle source
# File lib/newline_hw/config.rb, line 32
def terminal
  config["terminal"]
end
update(options) click to toggle source
# File lib/newline_hw/config.rb, line 14
def update(options)
  @config = config.merge(options)
end