Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

set logger accessor

  • Loading branch information...
commit 39a0d627a1f20dd75f91c9b4b9020f12e58507f2 1 parent 7a7e02c
@flyerhzm authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/regexp_crawler/crawler.rb
View
6 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 = []
Please sign in to comment.
Something went wrong with that request. Please try again.