Class: Runcom::Paths::Common
- Inherits:
-
Object
- Object
- Runcom::Paths::Common
- Defined in:
- lib/runcom/paths/common.rb
Overview
Provides common path/functionality for all XDG enhanced objects.
Instance Attribute Summary collapse
-
#initial ⇒ Object
readonly
Returns the value of attribute initial.
Instance Method Summary collapse
- #active ⇒ Object
- #all ⇒ Object
- #file_name ⇒ Object
- #global ⇒ Object
-
#initialize(initial, context: Context.new) ⇒ Common
constructor
A new instance of Common.
- #inspect ⇒ Object
- #local ⇒ Object
- #namespace ⇒ Object
- #passive ⇒ Object
- #to_s ⇒ Object (also: #to_str)
Constructor Details
Instance Attribute Details
#initial ⇒ Object (readonly)
Returns the value of attribute initial.
11 12 13 |
# File 'lib/runcom/paths/common.rb', line 11 def initial @initial end |
Instance Method Details
#active ⇒ Object
23 |
# File 'lib/runcom/paths/common.rb', line 23 def active = all.select(&:file?).find(&:exist?) |
#all ⇒ Object
34 |
# File 'lib/runcom/paths/common.rb', line 34 def all = xdg.all.map { |root| root.join initial } |
#file_name ⇒ Object
21 |
# File 'lib/runcom/paths/common.rb', line 21 def file_name = initial.basename |
#global ⇒ Object
27 28 29 30 |
# File 'lib/runcom/paths/common.rb', line 27 def global all.tap { |paths| paths.delete local } .first end |
#inspect ⇒ Object
40 |
# File 'lib/runcom/paths/common.rb', line 40 def inspect = "#<#{self.class}:#{object_id} #{xdg}>" |
#local ⇒ Object
32 |
# File 'lib/runcom/paths/common.rb', line 32 def local = all.first |
#namespace ⇒ Object
19 |
# File 'lib/runcom/paths/common.rb', line 19 def namespace = initial.parent |
#passive ⇒ Object
25 |
# File 'lib/runcom/paths/common.rb', line 25 def passive = active || global |
#to_s ⇒ Object Also known as: to_str
36 |
# File 'lib/runcom/paths/common.rb', line 36 def to_s = xdg.to_s |