Sha256: 78d3c8755970f09304e482dd24907d01982f4290f58afc242ea850be0e6c748e
Contents?: true
Size: 766 Bytes
Versions: 2
Compression:
Stored size: 766 Bytes
Contents
# frozen_string_literal: true require "forwardable" module Runcom module Paths # A XDG home path with a loose adherence to XDG specification by preferring local path if it # exists, otherwise defaulting to standard computed path. class Friendly extend Forwardable delegate %i[key value default] => :standard def initialize pair, environment = ENV @standard = XDG::Paths::Standard.new pair, environment end def dynamic String(value).then do |path| File.exist?(path) ? Pathname(path).expand_path : standard.dynamic end end def inspect [standard.key, dynamic].compact.join XDG::PAIR_DELIMITER end private attr_reader :standard end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
runcom-5.1.1 | lib/runcom/paths/friendly.rb |
runcom-5.1.0 | lib/runcom/paths/friendly.rb |