Sha256: abc08393d49b8e50c9f9d7219ea6d27292007a5483af034029924dda886d135f

Contents?: true

Size: 451 Bytes

Versions: 7

Compression:

Stored size: 451 Bytes

Contents

# frozen_string_literal: true

module Runcom
  # A developer friendly wrapper of XDG cache.
  Cache = Struct.new :name, :home, :environment, keyword_init: true do
    def initialize *arguments
      super

      self[:home] ||= Runcom::Paths::Friendly
      self[:environment] ||= ENV
      freeze
    end

    def path
      paths.find(&:exist?)
    end

    def paths
      XDG::Cache.new(home: home, environment: environment).all
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
runcom-5.0.2 lib/runcom/cache.rb
runcom-5.0.1 lib/runcom/cache.rb
runcom-5.0.0 lib/runcom/cache.rb
runcom-4.2.1 lib/runcom/cache.rb
runcom-4.2.0 lib/runcom/cache.rb
runcom-4.1.0 lib/runcom/cache.rb
runcom-4.0.0 lib/runcom/cache.rb