Module: Twingly::StringUtilities

Defined in:
lib/twingly/string_utilities.rb

Class Method Summary collapse

Class Method Details

.logfmt(hsh) ⇒ Object



7
8
9
# File 'lib/twingly/string_utilities.rb', line 7

def logfmt(hsh)
  hsh.map { |key, value| "#{key}=#{value}" }.join(" ")
end

.split_key_pair(key_pair) ⇒ Object



21
22
23
# File 'lib/twingly/string_utilities.rb', line 21

def split_key_pair(key_pair)
  key_pair.to_s.split(":")
end

.strip_start_character(string, char:) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/twingly/string_utilities.rb', line 11

def strip_start_character(string, char:)
  return unless string

  if string[0] == char
    string[1..-1]
  else
    string
  end
end