Class: XDG::Paths::Directory
- Inherits:
-
Any
- Object
- Any
- XDG::Paths::Directory
show all
- Defined in:
- lib/xdg/paths/directory.rb
Overview
A collection of XDG directories.
Constant Summary
collapse
- DELIMITER =
":"
Instance Method Summary
collapse
Methods inherited from Any
#initialize
Instance Method Details
#default ⇒ Object
9
|
# File 'lib/xdg/paths/directory.rb', line 9
def default = value.split(DELIMITER).map { |path| expand path }
|
#dynamic ⇒ Object
11
12
13
14
15
16
|
# File 'lib/xdg/paths/directory.rb', line 11
def dynamic
String(environment[key]).then { |env_value| env_value.empty? ? value : env_value }
.split(DELIMITER)
.uniq
.map { |path| expand path }
end
|
#inspect ⇒ Object
22
23
24
25
26
27
|
# File 'lib/xdg/paths/directory.rb', line 22
def inspect
pairs = to_s
type = self.class
pairs.empty? ? "#<#{type}:#{object_id}>" : "#<#{type}:#{object_id} #{self}>"
end
|
#key ⇒ Object
29
|
# File 'lib/xdg/paths/directory.rb', line 29
def key = String pair.key
|
#to_s ⇒ Object
Also known as:
to_str
18
|
# File 'lib/xdg/paths/directory.rb', line 18
def to_s = [key, dynamic.join(DELIMITER)].reject(&:empty?).join XDG::DELIMITER
|
#value ⇒ Object
31
|
# File 'lib/xdg/paths/directory.rb', line 31
def value = String pair.value
|