Method: Wavefront::Validators#wf_name?

Defined in:
lib/wavefront-sdk/validators.rb

#wf_name?(name) ⇒ Boolean

Ensure the given argument is a valid name, for instance for an event. Names can contain, AFAIK, word characters.

raise Wavefront::Exception::InvalidName if name is not valid

Parameters:

  • name (String)

    the name to validate

Returns:

  • (Boolean)

    true if the name is valid

Raises:



66
67
68
69
70
# File 'lib/wavefront-sdk/validators.rb', line 66

def wf_name?(name)
  return true if name.is_a?(String) && name.size < 1024 && name =~ /^\w+$/

  raise Wavefront::Exception::InvalidName, name
end