Class: Runcom::Paths::Home

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/runcom/paths/home.rb

Overview

A XDG home path that prefers local over global path.

Instance Method Summary collapse

Constructor Details

#initialize(pair, environment = ENV) ⇒ Home

Returns a new instance of Home.



13
14
15
16
# File 'lib/runcom/paths/home.rb', line 13

def initialize pair, environment = ENV
  @standard = XDG::Paths::Home.new pair, environment
  freeze
end

Instance Method Details

#dynamicObject



18
19
20
21
# File 'lib/runcom/paths/home.rb', line 18

def dynamic
  String(value).then { |path| Pathname path }
               .then { |path| [path.expand_path, standard.dynamic] }
end

#inspectObject



29
# File 'lib/runcom/paths/home.rb', line 29

def inspect = "#<#{self.class}:#{object_id} #{self}>"

#to_sObject Also known as: to_str



23
24
25
# File 'lib/runcom/paths/home.rb', line 23

def to_s
  [standard.key, dynamic.join(XDG::Paths::Directory::DELIMITER)].compact.join XDG::DELIMITER
end