Sha256: 4bf27674ca59f88d618bc8540e387f2ef8d4a342db96458bc41b9abd40e69ff4
Contents?: true
Size: 575 Bytes
Versions: 11
Compression:
Stored size: 575 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 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 end
Version data entries
11 entries across 11 versions & 1 rubygems