Class: Perron::Site::Builder::Page
- Inherits:
-
Object
- Object
- Perron::Site::Builder::Page
- Defined in:
- lib/perron/site/builder/page.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ Page
constructor
A new instance of Page.
- #render ⇒ Object
Constructor Details
#initialize(path) ⇒ Page
Returns a new instance of Page.
9 10 11 |
# File 'lib/perron/site/builder/page.rb', line 9 def initialize(path) @output_path, @path = Rails.root.join(Perron.configuration.output), path end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/perron/site/builder/page.rb', line 13 def render action = route_info[:action] request = ActionDispatch::Request.new(env) response = ActionDispatch::Response.new request.path_parameters = route_info controller.dispatch(action, request, response) return puts " ❌ ERROR: Request failed for '#{@path}' (Status: #{response.status})" unless response.successful? save_html(response.body) rescue => error puts " ❌ ERROR: Failed to generate page for '#{@path}'. Details: #{error.class} - #{error.}\n#{error.backtrace.first(3).join("\n")}" end |