Class: RailsAngularSeo::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_angular_seo/renderer.rb

Class Method Summary collapse

Class Method Details

.render(phantomjs_path, seo_id, path_without_port, options = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/rails_angular_seo/renderer.rb', line 4

def self.render(phantomjs_path, seo_id, path_without_port, options = {})
  output = ""
  options = {phantomjs_options: []}.merge(options)
  open_options = [phantomjs_path] + options[:phantomjs_options] + [File.expand_path("../../../phantomjs/phantomjs-runner.js", __FILE__), path_without_port, seo_id]
  output = IO.popen(open_options){|phantom_output| output = phantom_output.read}
  [200, { "Content-Type" => "text/html" }, [output]]
end