Skip to content

Commit

Permalink
set logger accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Feb 6, 2010
1 parent 7a7e02c commit 39a0d62
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/regexp_crawler/crawler.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module RegexpCrawler
class Crawler
attr_accessor :start_page, :continue_regexp, :named_captures, :model, :save_method, :headers, :encoding, :need_parse, :logger
attr_accessor :start_page, :continue_regexp, :named_captures, :model, :save_method, :headers, :encoding, :need_parse

def initialize(options = {})
@start_page = options[:start_page]
Expand All @@ -19,6 +19,10 @@ def capture_regexp=(regexp)
@capture_regexp = Regexp.new(regexp.source, regexp.options | Regexp::MULTILINE)
end

def logger=(logger)
@logger = logger == true ? Logger.new(STDOUT) : logger
end

def start
@results = []
@captured_pages = []
Expand Down

0 comments on commit 39a0d62

Please sign in to comment.