Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis committed May 3, 2012
1 parent f370588 commit 606ffda
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/is_taggable/tag_list/youtube.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ class Youtube < Base
protected

def split_tags(str)
if str.index(',') != nil # если запятые есть
result = str.split(',') # разделяем по ним
if str.index(',') != nil # commas?
result = str.split(',') # - split by 'em
elsif str.index('"') != nil # quotation marks?
quoted_tag_list = str.scan(/"[^"]+?"/)
quoted_tag_list.each {|v| str.gsub!(v, '') }
quoted_tag_list.each {|v| v.gsub!('"', '') }
result = (str.split(' ') + quoted_tag_list)
else
if str.index('"') != nil # если есть кавычки.
quoted_tag_list = str.scan(/"[^"]+?"/) #выделяем квотированные теги
quoted_tag_list.each {|v| str.gsub!(v, '') } # удаляем все квотированные теги
quoted_tag_list.each {|v| v.gsub!('"','')} # удаляем все кавычки
result = (str.split(' ') + quoted_tag_list) #собираем список обратно
else
result = str.split(' ') # если ни запятых ни кавычек нет, разделяем просто по пробелам
end
result = str.split(' ') # split by spaces
end
end

Expand All @@ -22,7 +20,7 @@ def normalize_tag(tag)
end

def reject_tag(tag)
tag.size<2
tag.size < 2
end

def join_tags(list)
Expand Down

0 comments on commit 606ffda

Please sign in to comment.