Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/wavefront-sdk/stdlib/hash.rb

Overview

Extensions to stdlib Hash

Instance Method Summary collapse

Instance Method Details

#cleanseObject

Drop any key-value pairs where the value is not truthy



15
16
17
# File 'lib/wavefront-sdk/stdlib/hash.rb', line 15

def cleanse
  select { |_k, v| v }
end

#to_wf_tagObject

Convert a tag hash into a string. The quoting is recommended in the WF wire-format guide. No validation is performed here.



9
10
11
# File 'lib/wavefront-sdk/stdlib/hash.rb', line 9

def to_wf_tag
  map { |k, v| format('%s="%s"', k, v.tagescape) }.join(' ')
end