Class: Blinkr::PhantomJSWrapper
- Inherits:
-
Object
- Object
- Blinkr::PhantomJSWrapper
- Includes:
- HttpUtils
- Defined in:
- lib/blinkr/phantomjs_wrapper.rb
Constant Summary collapse
- SNAP_JS =
File.('snap.js', File.dirname(__FILE__))
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
-
#initialize(config, context) ⇒ PhantomJSWrapper
constructor
A new instance of PhantomJSWrapper.
- #name ⇒ Object
- #process(url, limit, &block) ⇒ Object
- #process_all(urls, limit, &block) ⇒ Object
Methods included from HttpUtils
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
#count ⇒ Object (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
#name ⇒ Object
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 |