Class: Blinkr::PhantomJSWrapper

Inherits:
Object
  • Object
show all
Includes:
HttpUtils
Defined in:
lib/blinkr/phantomjs_wrapper.rb

Constant Summary collapse

SNAP_JS =
File.expand_path('snap.js', File.dirname(__FILE__))

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HttpUtils

#retry?, #sanitize

Constructor Details

#initialize(config, context) ⇒ PhantomJSWrapper

Returns a new instance of PhantomJSWrapper.



16
17
18
19
20
# File 'lib/blinkr/phantomjs_wrapper.rb', line 16

def initialize config, context
  @config = config.validate
  @context = context
  @count = 0
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



14
15
16
# File 'lib/blinkr/phantomjs_wrapper.rb', line 14

def count
  @count
end

Instance Method Details

#nameObject



32
33
34
# File 'lib/blinkr/phantomjs_wrapper.rb', line 32

def name
  'phantomjs'
end

#process(url, limit, &block) ⇒ Object



28
29
30
# File 'lib/blinkr/phantomjs_wrapper.rb', line 28

def process url, limit, &block
  _process url, limit, limit, &block
end

#process_all(urls, limit, &block) ⇒ Object



22
23
24
25
26
# File 'lib/blinkr/phantomjs_wrapper.rb', line 22

def process_all urls, limit, &block
  Parallel.each(urls, :in_threads => @config.phantomjs_threads) do |url|
    process url, limit, &block
  end
end