Class: Runcom::Paths::Common
- Inherits:
-
Object
- Object
- Runcom::Paths::Common
- Extended by:
- Forwardable
- Defined in:
- lib/runcom/paths/common.rb
Overview
Provides common path/functionality for all XDG enhanced objects.
Instance Attribute Summary collapse
-
#relative ⇒ Object
readonly
Returns the value of attribute relative.
Instance Method Summary collapse
- #all ⇒ Object
- #current ⇒ Object
- #file_name ⇒ Object
-
#initialize(relative, context: Context.new) ⇒ Common
constructor
A new instance of Common.
- #namespace ⇒ Object
Constructor Details
#initialize(relative, context: Context.new) ⇒ Common
Returns a new instance of Common.
16 17 18 19 |
# File 'lib/runcom/paths/common.rb', line 16 def initialize relative, context: Context.new @relative = Pathname relative @context = context end |
Instance Attribute Details
#relative ⇒ Object (readonly)
Returns the value of attribute relative.
14 15 16 |
# File 'lib/runcom/paths/common.rb', line 14 def relative @relative end |
Instance Method Details
#all ⇒ Object
33 34 35 |
# File 'lib/runcom/paths/common.rb', line 33 def all xdg.all.map { |root| root.join relative } end |
#current ⇒ Object
29 30 31 |
# File 'lib/runcom/paths/common.rb', line 29 def current all.find(&:exist?) end |
#file_name ⇒ Object
25 26 27 |
# File 'lib/runcom/paths/common.rb', line 25 def file_name relative.basename end |
#namespace ⇒ Object
21 22 23 |
# File 'lib/runcom/paths/common.rb', line 21 def namespace relative.parent end |