Class: Hanami::Router::Formatter::CSV Private
- Inherits:
-
Object
- Object
- Hanami::Router::Formatter::CSV
- Defined in:
- lib/hanami/router/formatter/csv.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- DEFAULT_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ write_headers: true }.freeze
- HEADERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[METHOD PATH TO AS CONSTRAINTS].freeze
Instance Method Summary collapse
Instance Method Details
#call(routes, **csv_opts) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 43 44 45 46 |
# File 'lib/hanami/router/formatter/csv.rb', line 39 def call(routes, **csv_opts) ::CSV.generate(**DEFAULT_OPTIONS, **csv_opts) do |csv| csv << HEADERS if csv.write_headers? routes.reduce(csv) do |acc, route| route.head? ? acc : acc << row(route) end end end |