class PostHog::FieldParser
def valid_uuid_for_event_props?(uuid)
-
(TrueClass, FalseClass)
- - true if the UUID is valid or absent, false otherwise
Parameters:
-
uuid
(Object
) -- - the UUID to validate, user provided, so we don't know the type
def valid_uuid_for_event_props?(uuid) return true if uuid.nil? unless uuid.is_a?(String) logger.warn 'UUID is not a string. Ignoring it.' return false end is_valid_uuid = uuid.match?(/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i) logger.warn "UUID is not valid: #{uuid}. Ignoring it." unless is_valid_uuid is_valid_uuid end