Module: JsxRosetta::PagesRouting::ControllerEmitter

Defined in:
lib/jsx_rosetta/pages_routing.rb

Overview

Renders ApplicationController-inheriting skeletons, one per controller in the route table. Each action body is empty; URL params for that action are listed in a comment above the def.

Class Method Summary collapse

Class Method Details

.emit(routes:) ⇒ Object



594
595
596
597
598
599
600
601
602
# File 'lib/jsx_rosetta/pages_routing.rb', line 594

def emit(routes:)
  unique = routes.uniq { |r| [r.namespace, r.controller, r.action] }
  unique.group_by { |r| [r.namespace, r.controller] }.sort.map do |(namespace, controller), group_routes|
    ControllerFile.new(
      path: controller_path(namespace, controller),
      contents: render(namespace, controller, group_routes.sort_by(&:action))
    )
  end
end