Class: Uploadcare::Internal::FileTagNormalizer
- Inherits:
-
Object
- Object
- Uploadcare::Internal::FileTagNormalizer
- Defined in:
- lib/uploadcare/internal/file_tag_normalizer.rb
Overview
Normalizes and validates file tags before sending them to Uploadcare.
Constant Summary collapse
- MAX_LENGTH =
100- MAX_COUNT =
50- VALID_PATTERN =
/\A[a-z0-9._-]+\z/
Class Method Summary collapse
-
.call(tags, max_count: MAX_COUNT) ⇒ Array<String>
Normalize a list of file tags.
Class Method Details
.call(tags, max_count: MAX_COUNT) ⇒ Array<String>
Normalize a list of file tags.
Tags are stripped, lowercased, and deduplicated while preserving their first-seen order.
19 20 21 22 23 24 25 |
# File 'lib/uploadcare/internal/file_tag_normalizer.rb', line 19 def call(, max_count: MAX_COUNT) raise ArgumentError, 'tags must be an array of strings' unless .is_a?(Array) normalized = normalize() validate_count(normalized, max_count) normalized end |