Method: Wavefront::Validators#wf_ts?

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

#wf_ts?(timestamp) ⇒ Boolean

Ensure the given argument is a valid timestamp

Parameters:

  • timestamp (DateTime)

    the timestamp name to validate

Returns:

  • (Boolean)

    True if the value is valid

Raises:

  • Wavefront::Exception::InvalidTimestamp



97
98
99
100
101
# File 'lib/wavefront-sdk/validators.rb', line 97

def wf_ts?(timestamp)
  return true if timestamp.is_a?(Time) || timestamp.is_a?(Date)

  raise Wavefront::Exception::InvalidTimestamp, timestamp
end