Sha256: 26bddd5cceb1a3806017f97742cf1073ab77757cddb73225583a03aa2bd982bf

Contents?: true

Size: 677 Bytes

Versions: 8

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "pathname"

module Runcom
  module Paths
    # Provides common path/functionality for all XDG enhanced objects.
    class Common
      extend Forwardable

      delegate %i[inspect] => :xdg

      attr_reader :relative

      def initialize relative, context: Context.new
        @relative = Pathname relative
        @context = context
      end

      def namespace = relative.parent

      def file_name = relative.basename

      def current = all.find(&:exist?)

      def all = xdg.all.map { |root| root.join relative }

      private

      attr_reader :context

      def xdg = context.xdg
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
runcom-8.1.0 lib/runcom/paths/common.rb
runcom-8.0.1 lib/runcom/paths/common.rb
runcom-8.0.0 lib/runcom/paths/common.rb
runcom-7.3.0 lib/runcom/paths/common.rb
runcom-7.2.0 lib/runcom/paths/common.rb
runcom-7.1.3 lib/runcom/paths/common.rb
runcom-7.1.2 lib/runcom/paths/common.rb
runcom-7.1.1 lib/runcom/paths/common.rb