lib/phantomjs.rb in phantomjs-1.8.1.0 vs lib/phantomjs.rb in phantomjs-1.8.1.1
- old
+ new
@@ -37,9 +37,17 @@
# Clears cached state. Primarily useful for testing.
def reset!
@base_dir = @path = nil
end
+
+ # Run phantomjs with the given arguments, and either
+ # return the stdout or yield each line to the passed block.
+ def run(*args, &block)
+ IO.popen([path, *args]) do |io|
+ block ? io.each(&block) : io.read
+ end
+ end
end
end
require 'phantomjs/platform'
Phantomjs.available_platforms << Phantomjs::Platform::Linux32
\ No newline at end of file