Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/wavefront-sdk/stdlib/hash.rb
Overview
Extensions to stdlib Hash
Instance Method Summary collapse
-
#cleanse ⇒ Object
Drop any key-value pairs where the value is not truthy.
-
#to_wf_tag ⇒ Object
Convert a tag hash into a string.
Instance Method Details
#cleanse ⇒ Object
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_tag ⇒ Object
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 |