class XDG::Paths::Home
A XDG
home path.
Constants
- KEY
Public Class Methods
new(pair, environment = ENV)
click to toggle source
# File lib/xdg/paths/home.rb, line 16 def initialize pair, environment = ENV @pair = pair @environment = environment end
Public Instance Methods
default(= expand String(value))
click to toggle source
# File lib/xdg/paths/home.rb, line 21 def default = expand String(value) def dynamic = String(environment[key]).then { |path| path.empty? ? default : expand(path) } def to_s = [pair.key, dynamic].compact.join XDG::DELIMITER alias to_str to_s def inspect = "#<#{self.class}:#{object_id} #{self}>" private attr_reader :pair, :environment def expand(path) = home.join(path).expand_path def home = Pathname environment.fetch(KEY)
dynamic(= String(environment[key]).then { |path| path.empty? ? default : expand(path) })
click to toggle source
# File lib/xdg/paths/home.rb, line 23 def dynamic = String(environment[key]).then { |path| path.empty? ? default : expand(path) } def to_s = [pair.key, dynamic].compact.join XDG::DELIMITER alias to_str to_s def inspect = "#<#{self.class}:#{object_id} #{self}>" private attr_reader :pair, :environment def expand(path) = home.join(path).expand_path def home = Pathname environment.fetch(KEY) end
expand(path)
click to toggle source
# File lib/xdg/paths/home.rb, line 35 def expand(path) = home.join(path).expand_path def home = Pathname environment.fetch(KEY) end end
home(= Pathname environment.fetch(KEY))
click to toggle source
# File lib/xdg/paths/home.rb, line 37 def home = Pathname environment.fetch(KEY) end
inspect(= "
click to toggle source
# File lib/xdg/paths/home.rb, line 29 def inspect = "#<#{self.class}:#{object_id} #{self}>" private attr_reader :pair, :environment def expand(path) = home.join(path).expand_path def home = Pathname environment.fetch(KEY) end end end
to_s(= [pair.key, dynamic].compact.join XDG::DELIMITER)
click to toggle source
# File lib/xdg/paths/home.rb, line 25 def to_s = [pair.key, dynamic].compact.join XDG::DELIMITER alias to_str to_s def inspect = "#<#{self.class}:#{object_id} #{self}>" private attr_reader :pair, :environment def expand(path) = home.join(path).expand_path def home = Pathname environment.fetch(KEY) end end