Sha256: a00775578c5edb952ddf912893bc31b91a3f36c6fb03faeaeb69288288f2ef49

Contents?: true

Size: 694 Bytes

Versions: 11

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "xdg/pair"

module XDG
  # Provides configuration support.
  class Config
    extend Forwardable

    HOME_PAIR = Pair["XDG_CONFIG_HOME", ".config"].freeze
    DIRS_PAIR = Pair["XDG_CONFIG_DIRS", "/etc/xdg"].freeze

    delegate %i[home directories all to_s to_str] => :combined

    def initialize home: Paths::Home, directories: Paths::Directory, environment: ENV
      @combined = Paths::Combined.new home.new(HOME_PAIR, environment),
                                      directories.new(DIRS_PAIR, environment)
    end

    def inspect = "#<#{self.class}:#{object_id} #{self}>"

    private

    attr_reader :combined
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
xdg-8.10.0 lib/xdg/config.rb
xdg-8.9.0 lib/xdg/config.rb
xdg-8.8.0 lib/xdg/config.rb
xdg-8.7.0 lib/xdg/config.rb
xdg-8.6.0 lib/xdg/config.rb
xdg-8.5.0 lib/xdg/config.rb
xdg-8.4.1 lib/xdg/config.rb
xdg-8.3.0 lib/xdg/config.rb
xdg-8.2.0 lib/xdg/config.rb
xdg-8.1.0 lib/xdg/config.rb
xdg-8.0.0 lib/xdg/config.rb