remove constants / replace by class methods
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
class TagSanitizer
|
||||
TAG_MAX_LENGTH = 40
|
||||
|
||||
DISALLOWED_STRINGS = %w(? < > = /)
|
||||
|
||||
def sanitize_tag(tag)
|
||||
@@ -8,11 +6,15 @@ class TagSanitizer
|
||||
DISALLOWED_STRINGS.each do |s|
|
||||
tag.gsub!(s, '')
|
||||
end
|
||||
tag.truncate(TAG_MAX_LENGTH)
|
||||
tag.truncate(TagSanitizer.tag_max_length)
|
||||
end
|
||||
|
||||
def sanitize_tag_list(tag_list)
|
||||
tag_list.map { |tag| sanitize_tag(tag) }
|
||||
end
|
||||
|
||||
def self.tag_max_length
|
||||
40
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user