Sha256: ddaf1444264367320b60ae0ba4ce35ea1e960c2ecb6dd200bd08ff5168dfbadc

Contents?: true

Size: 374 Bytes

Versions: 13

Compression:

Stored size: 374 Bytes

Contents

# frozen_string_literal: true

module XDG
  PAIR_DELIMITER = "="

  # A generic key-value pair (KVP).
  Pair = Struct.new :key, :value do
    def to_env = Hash[*values]

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

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

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
xdg-6.6.2 lib/xdg/pair.rb
xdg-6.6.1 lib/xdg/pair.rb
xdg-6.6.0 lib/xdg/pair.rb
xdg-6.5.0 lib/xdg/pair.rb
xdg-6.4.0 lib/xdg/pair.rb
xdg-6.3.3 lib/xdg/pair.rb
xdg-6.3.2 lib/xdg/pair.rb
xdg-6.3.1 lib/xdg/pair.rb
xdg-6.3.0 lib/xdg/pair.rb
xdg-6.2.0 lib/xdg/pair.rb
xdg-6.1.0 lib/xdg/pair.rb
xdg-6.0.1 lib/xdg/pair.rb
xdg-6.0.0 lib/xdg/pair.rb