class LogView::Config

Constants

CONFIG_FILE_NAME
CONFIG_SAMPLE

Attributes

projects[R]

Public Class Methods

config_file_path() click to toggle source
# File lib/log_view/config.rb, line 36
def self.config_file_path
  File.join(Dir.home, CONFIG_FILE_NAME)
end
new() click to toggle source
# File lib/log_view/config.rb, line 22
def initialize
  path = Config.config_file_path
  File.open(path, "w") {|f| f.write(CONFIG_SAMPLE)} unless File.exists?(path)

  hash = YAML.load_file(path)
  @projects = hash ? hash.keys : []
  @config = OpenStruct.new(hash)
end

Public Instance Methods

load_project(name) click to toggle source
# File lib/log_view/config.rb, line 31
def load_project name
  project_config = @config.send("#{name}")       
  OpenStruct.new(project_config)
end