class Til::Settings

Attributes

settings[R]
settings_file_path[R]

Public Class Methods

load() click to toggle source
# File lib/til/models/settings.rb, line 7
def self.load
  @settings_file_path = File.expand_path("~/.til.config")
  if File.exist?(@settings_file_path)
    self.new(@settings_file_path)
  else
    puts "You don't appear to have a settings file! Configuring one now.".red
    Initializer.new.create_settings_file(@settings_file_path)
    self.new(@settings_file_path)
  end
end
new(config_file) click to toggle source
# File lib/til/models/settings.rb, line 32
def initialize(config_file)
  @settings = JSON.parse(File.read(config_file))
end

Public Instance Methods

directory() click to toggle source
# File lib/til/models/settings.rb, line 18
def directory
  File.expand_path(settings["directory"])
end
editor() click to toggle source
# File lib/til/models/settings.rb, line 26
def editor
  settings["editor"] || ENV["VISUAL"] || ENV["EDITOR"] || "vim"
end
github_repo() click to toggle source
# File lib/til/models/settings.rb, line 22
def github_repo
  settings["github_repo"]
end