Sha256: 04f67b3af7c2a2f1fee632010dc802aba5d7548b06a07d9ffffad4cdd17c4c39
Contents?: true
Size: 796 Bytes
Versions: 11
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true require "forwardable" require "pathname" module Runcom module Paths # A XDG home path that prefers local over global path. class Home extend Forwardable delegate %i[key value default] => :standard def initialize pair, environment = ENV @standard = XDG::Paths::Home.new pair, environment end def dynamic String(value).then { |path| Pathname path } .then { |path| [path.expand_path, standard.dynamic] } end def to_s [standard.key, dynamic.join(XDG::Paths::Directory::DELIMITER)].compact.join XDG::DELIMITER end alias to_str to_s def inspect = "#<#{self.class}:#{object_id} #{self}>" private attr_reader :standard end end end
Version data entries
11 entries across 11 versions & 1 rubygems