Module: WorkMd::Config

Defined in:
lib/work_md/config.rb

Constant Summary collapse

DEFAULT_WORK_DIR =
"#{Dir.home}/work_md"
TRANSLATIONS =
{
  'pt' =>
    {
      tasks: 'Atividades',
      meetings: 'Reuniões',
      interruptions: 'Interrupções',
      difficulties: 'Dificuldades',
      observations: 'Observações',
      pomodoros: 'Pomodoros / Ciclos',
      per_day: 'por dia',
      total: 'total',
      days_bars: 'Resumo'
    },
  'en' =>
    {
      tasks: 'Tasks',
      meetings: 'Meetings',
      interruptions: 'Interruptions',
      difficulties: 'Difficulties',
      observations: 'Observations',
      pomodoros: 'Pomodoros / Cycles',
      per_day: 'per day',
      total: 'all',
      days_bars: 'Summary'
    },
  'es' =>
    {
      tasks: 'Tareas',
      meetings: 'Reuniones',
      interruptions: 'Interrupciones',
      difficulties: 'Dificultades',
      observations: 'Observaciones',
      pomodoros: 'Pomodoros / Ciclos',
      per_day: 'por día',
      total: 'total',
      days_bars: 'Abstracto'
    }
}.freeze

Class Method Summary collapse

Class Method Details

.editorObject



51
52
53
# File 'lib/work_md/config.rb', line 51

def self.editor
  ENV['EDITOR'] || ENV['VISUAL'] || yaml_file['editor'] || nil
end

.titleObject



47
48
49
# File 'lib/work_md/config.rb', line 47

def self.title
  yaml_file['title'] || ''
end

.translationsObject



59
60
61
62
63
# File 'lib/work_md/config.rb', line 59

def self.translations
  TRANSLATIONS[ENV['WORK_MD_LANG']] ||
    TRANSLATIONS[yaml_file['lang']] ||
    TRANSLATIONS['en']
end

.work_dirObject



55
56
57
# File 'lib/work_md/config.rb', line 55

def self.work_dir
  ENV['WORK_MD_DIR'] || DEFAULT_WORK_DIR
end

.yaml_fileObject



65
66
67
68
69
# File 'lib/work_md/config.rb', line 65

def self.yaml_file
  YAML.load_file("#{DEFAULT_WORK_DIR}/config.yml")
rescue StandardError
  {}
end