Sha256: 057c75f26049459958bd7b419698fec6c728a007fdb6a3641a83317ef4b69769

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "xdg/pair"

module XDG
  # Provides data support.
  class Data
    extend Forwardable

    HOME_PAIR = Pair["XDG_DATA_HOME", ".local/share"].freeze
    DIRS_PAIR = Pair["XDG_DATA_DIRS", "/usr/local/share:/usr/share"].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)
      freeze
    end

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

    private

    attr_reader :combined
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xdg-9.0.0 lib/xdg/data.rb