Sha256: 72817d3bfa4b2d2ff89e051e940962b0f5580427f565d0e3ad87ee474d61dda4

Contents?: true

Size: 642 Bytes

Versions: 1

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "xdg/pair"

module XDG
  # Provides state support.
  class State
    extend Forwardable

    HOME_PAIR = Pair["XDG_STATE_HOME", ".local/state"].freeze

    delegate %i[home directories all to_s to_str] => :combined

    def initialize home: Paths::Home, directories: Paths::Directory, environment: ENV
      @combined = Paths::Combined.new home.new(HOME_PAIR, environment),
                                      directories.new(Pair.new, environment)
      freeze
    end

    def inspect = "#<#{self.class}:#{object_id} #{self}>"

    private

    attr_reader :combined
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xdg-9.0.0 lib/xdg/state.rb