Module: XDG

Defined in:
lib/xdg.rb,
lib/xdg/data.rb,
lib/xdg/pair.rb,
lib/xdg/cache.rb,
lib/xdg/state.rb,
lib/xdg/config.rb,
lib/xdg/paths/home.rb,
lib/xdg/environment.rb,
lib/xdg/paths/combined.rb,
lib/xdg/paths/directory.rb

Overview

Main namespace.

Defined Under Namespace

Modules: Paths Classes: Cache, Config, Data, Environment, State

Constant Summary collapse

DELIMITER =
"="
Pair =

A generic key-value pair (KVP).

Data.define :key, :value do
  def initialize key: nil, value: nil
    super
  end

  def key? = key.to_s.size.positive?

  def value? = value.to_s.size.positive?

  def empty? = !(key? && value?)

  def to_env = {key => value}

  def to_s = key? || value? ? "#{key}#{DELIMITER}#{value}" : ""

  alias_method :to_str, :to_s

  def inspect
    type = self.class
    key? || value? ? "#<data #{type} #{key}#{DELIMITER}#{value}>" : "#<data #{type}>"
  end
end

Class Method Summary collapse

Class Method Details

.newObject



17
# File 'lib/xdg.rb', line 17

def self.new = Environment.new