Created
February 10, 2015 23:39
-
-
Save devton/4e58f7d2a50ae356b4bb to your computer and use it in GitHub Desktop.
CrawledUrl Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CrawledUrl < ActiveRecord::Base | |
# Persiste uma URL no banco de dados | |
# caso ela já não tenha sido persistida ou | |
# não tenha nenhuma expressão negativa | |
def self.persist_from url | |
self.find_or_create_by ::Crawler::UrlParser.parse(url) unless NegativeExpression.url_match?(url) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment