Class: Ppl::Application::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ppl/application/configuration.rb

Constant Summary collapse

USER_CONFIG =
"~/.pplconfig"
REPO_CONFIG =
"./.ppl/config"

Instance Method Summary collapse

Instance Method Details

#address_book_pathObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ppl/application/configuration.rb', line 8

def address_book_path
  default_config = default_configuration
  user_config    = user_configuration

  path = default_config["address book"]["path"]
  if !user_config["address book"].nil? && !user_config["address book"]["path"].nil?
    path = File.expand_path(user_config["address book"]["path"])
  end

  return path
end

#aliasesObject



20
21
22
23
24
25
26
27
28
# File 'lib/ppl/application/configuration.rb', line 20

def aliases
  user_aliases = user_configuration["alias"]
  default_aliases = default_configuration["alias"]
  if user_aliases.nil?
    default_aliases
  else
    user_aliases
  end
end

#color_enabled(command_name) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/ppl/application/configuration.rb', line 30

def color_enabled(command_name)
  config = user_configuration
  if !config["color"].nil? && config["color"][command_name] == "true"
    true
  else
    false
  end
end

#command_colors(command_name) ⇒ Object



39
40
41
42
43
44
# File 'lib/ppl/application/configuration.rb', line 39

def command_colors(command_name)
  return {} unless color_enabled(command_name)
  config = user_configuration
  search = "color \"#{command_name}\""
  result = config[search]
end

#prettyObject



46
47
48
# File 'lib/ppl/application/configuration.rb', line 46

def pretty
  user_configuration["pretty"]
end