Class: XDG::Paths::Any

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

Overview

A XDG any path.

Direct Known Subclasses

Directory, Home

Instance Method Summary collapse

Constructor Details

#initialize(pair, environment = ENV) ⇒ Any

Returns a new instance of Any.



13
14
15
16
17
# File 'lib/xdg/paths/any.rb', line 13

def initialize pair, environment = ENV
  @pair = pair
  @environment = environment
  freeze
end

Instance Method Details

#defaultObject



19
# File 'lib/xdg/paths/any.rb', line 19

def default = expand String(value)

#dynamicObject



21
# File 'lib/xdg/paths/any.rb', line 21

def dynamic = String(environment[key]).then { |path| path.empty? ? default : expand(path) }

#inspectObject



27
# File 'lib/xdg/paths/any.rb', line 27

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

#to_sObject Also known as: to_str



23
# File 'lib/xdg/paths/any.rb', line 23

def to_s = [pair.key, dynamic].compact.join XDG::DELIMITER