Sha256: 3fbcf5067048d34628bf211c82cc301caf0d9d0e821af74b026431963c34f020

Contents?: true

Size: 408 Bytes

Versions: 3

Compression:

Stored size: 408 Bytes

Contents

# frozen_string_literal: true

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

3 entries across 3 versions & 1 rubygems

Version Path
xdg-7.1.3 lib/xdg/pair.rb
xdg-7.1.2 lib/xdg/pair.rb
xdg-7.1.1 lib/xdg/pair.rb