Class: Docwatch::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/docwatch/config.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



3
4
5
6
7
# File 'lib/docwatch/config.rb', line 3

def initialize
    @config_dir = ENV.fetch('XDG_CONFIG_HOME', File.expand_path('~/.config'))
    @dir = File.join(@config_dir, 'org.crdx', 'docwatch')
    @data = load
end

Instance Method Details

#profilesObject



19
20
21
# File 'lib/docwatch/config.rb', line 19

def profiles
    @data&.dig('profiles') || {}
end

#styles_path(profile: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/docwatch/config.rb', line 9

def styles_path(profile: nil)
    name = profile || @data&.dig('profile')

    if name
        profile_path(name)
    else
        legacy_path
    end
end