Permalink
Browse files

set logger accessor

  • Loading branch information...
1 parent 7a7e02c commit 39a0d627a1f20dd75f91c9b4b9020f12e58507f2 @flyerhzm committed Feb 6, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/regexp_crawler/crawler.rb
@@ -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]
@@ -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 = []

0 comments on commit 39a0d62

Please sign in to comment.