Class: Blinkr::PhantomJSWrapper
- Inherits:
-
Object
- Object
- Blinkr::PhantomJSWrapper
- Includes:
- HttpUtils
- Defined in:
- lib/blinkr/phantomjs_wrapper.rb
Direct Known Subclasses
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
- #command ⇒ Object
-
#initialize(config, context) ⇒ PhantomJSWrapper
constructor
A new instance of PhantomJSWrapper.
- #name ⇒ Object
- #process(url, limit, opts = {}, &block) ⇒ Object
- #process_all(urls, limit, opts = {}, &block) ⇒ Object
Methods included from HttpUtils
Constructor Details
#initialize(config, context) ⇒ PhantomJSWrapper
Returns a new instance of PhantomJSWrapper.
17 18 19 20 21 22 |
# File 'lib/blinkr/phantomjs_wrapper.rb', line 17 def initialize config, context @config = config.validate @context = context @count = 0 @cache = Blinkr::Cache.new end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
15 16 17 |
# File 'lib/blinkr/phantomjs_wrapper.rb', line 15 def count @count end |
Instance Method Details
#command ⇒ Object
38 39 40 |
# File 'lib/blinkr/phantomjs_wrapper.rb', line 38 def command 'phantomjs' end |
#name ⇒ Object
34 35 36 |
# File 'lib/blinkr/phantomjs_wrapper.rb', line 34 def name 'phantomjs' end |
#process(url, limit, opts = {}, &block) ⇒ Object
30 31 32 |
# File 'lib/blinkr/phantomjs_wrapper.rb', line 30 def process url, limit, opts = {}, &block _process url, limit, limit, opts, &block end |
#process_all(urls, limit, opts = {}, &block) ⇒ Object
24 25 26 27 28 |
# File 'lib/blinkr/phantomjs_wrapper.rb', line 24 def process_all urls, limit, opts = {}, &block Parallel.each(urls, :in_threads => (@config.phantomjs_threads || Parallel.processor_count * 2)) do |url| process url, limit, opts, &block end end |