class RailsAngularSeo::Renderer

Public Class Methods

render(phantomjs_path, seo_id, path_without_port, options = {}) click to toggle source
# 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