Class: DatadogExporter::Monitors::Utilities::NameTransformer

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_exporter/monitors/utilities/name_transformer.rb

Overview

This class transform the monitor name to a valid file name

Instance Method Summary collapse

Instance Method Details

#transform(name) ⇒ String

 Transforms the monitor name to a valid file name

Parameters:

  • name (String)

    The monitor name

Returns:

  • (String)

    The transformed name



12
13
14
# File 'lib/datadog_exporter/monitors/utilities/name_transformer.rb', line 12

def transform(name)
  name.downcase.gsub(/\s*\|\s*/, "_").tr("/", "_").gsub(/\s+/, "_")
end