Class: Docwatch::Config
- Inherits:
-
Object
- Object
- Docwatch::Config
- Defined in:
- lib/docwatch/config.rb
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #profiles ⇒ Object
- #styles_path(profile: nil) ⇒ Object
Constructor Details
#initialize ⇒ Config
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.('~/.config')) @dir = File.join(@config_dir, 'org.crdx', 'docwatch') @data = load end |
Instance Method Details
#profiles ⇒ Object
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 |