Sha256: 2e2e1c832c875c15e4552ee985f5cae3d3fdcd2eea4a6acdd1dc2f5e2e37041d
Contents?: true
Size: 672 Bytes
Versions: 3
Compression:
Stored size: 672 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 private attr_reader :standard end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
runcom-5.0.2 | lib/runcom/paths/friendly.rb |
runcom-5.0.1 | lib/runcom/paths/friendly.rb |
runcom-5.0.0 | lib/runcom/paths/friendly.rb |