This commit is contained in:
Toks
2014-06-17 13:19:40 -04:00
parent 016ea330d0
commit 3103b97c8b
2 changed files with 14 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ class AliasAndImplicationImporter
end
def process!
tokens = tokenize(text)
tokens = AliasAndImplicationImporter.tokenize(text)
parse(tokens)
end
@@ -16,9 +16,8 @@ class AliasAndImplicationImporter
@rename_aliased_pages == "1"
end
private
def tokenize(text)
def self.tokenize(text)
text = text.dup
text.gsub!(/^\s+/, "")
text.gsub!(/\s+$/, "")
text.gsub!(/ {2,}/, " ")
@@ -41,6 +40,8 @@ private
end
end
private
def parse(tokens)
ActiveRecord::Base.transaction do
tokens.map do |token|