Sha256: d40724dede0966047031edba6ec8e7890624eafd0600b1275f75caa2b3a992c5

Contents?: true

Size: 433 Bytes

Versions: 5

Compression:

Stored size: 433 Bytes

Contents

# frozen_string_literal: true

# :reek:ModuleInitialize
module XDG
  # A generic key-value pair (KVP).
  Pair = Data.define :key, :value do
    def initialize key: nil, value: nil
      super
    end

    def to_env = {key => value}

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xdg-7.1.0 lib/xdg/pair.rb
xdg-7.0.3 lib/xdg/pair.rb
xdg-7.0.2 lib/xdg/pair.rb
xdg-7.0.1 lib/xdg/pair.rb
xdg-7.0.0 lib/xdg/pair.rb