Sha256: b30e09d2cb3702cc5b4e5f4f905a9e1a2a7afde578d516d8c787eca092b5f130
Contents?: true
Size: 661 Bytes
Versions: 3
Compression:
Stored size: 661 Bytes
Contents
# frozen_string_literal: true require "pathname" module XDG module Paths # A collection of XDG directories. class Directory DELIMITER = ":" def initialize pair, environment = ENV @pair = pair @environment = environment end def default paths.split(DELIMITER).map(&method(:expand)) end def dynamic environment.fetch(pair.key, paths).split(DELIMITER).uniq.map(&method(:expand)) end private attr_reader :pair, :environment def paths String pair.value end def expand path Pathname(path).expand_path end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xdg-3.0.2 | lib/xdg/paths/directory.rb |
xdg-3.0.1 | lib/xdg/paths/directory.rb |
xdg-3.0.0 | lib/xdg/paths/directory.rb |