Method: Wavefront::Validators#wf_version?

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

#wf_version?(version) ⇒ Boolean

Ensure the given argument is a valid version number

Parameters:

  • version (Integer)

    the version number to validate

Returns:

  • (Boolean)

    True if the version is valid

Raises:

  • Wavefront::Exception::InvalidVersion if the ID is not valid



169
170
171
172
173
174
# File 'lib/wavefront-sdk/validators.rb', line 169

def wf_version?(version)
  version = version.to_i if version.is_a?(String) && version =~ /^\d+$/
  return true if version.is_a?(Integer) && version.positive?

  raise Wavefront::Exception::InvalidVersion, version
end