Class: ActionDispatch::Routing::JSONFormatter
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::JSONFormatter
- Defined in:
- lib/action_dispatch/routing/json_formatter.rb
Instance Method Summary collapse
-
#header(routes) ⇒ Object
No need for a header, we only want data.
-
#initialize ⇒ JSONFormatter
constructor
A new instance of JSONFormatter.
-
#no_routes ⇒ Object
No routes will be represented by an empty object.
-
#result ⇒ Object
Serialize the buffer has as json.
- #section(routes) ⇒ Object
-
#section_title(title) ⇒ Object
No need for a title, we only want the data.
Constructor Details
#initialize ⇒ JSONFormatter
Returns a new instance of JSONFormatter.
9 10 11 |
# File 'lib/action_dispatch/routing/json_formatter.rb', line 9 def initialize @buffer = {} end |
Instance Method Details
#header(routes) ⇒ Object
No need for a header, we only want data
27 28 |
# File 'lib/action_dispatch/routing/json_formatter.rb', line 27 def header(routes) end |
#no_routes ⇒ Object
No routes will be represented by an empty object
31 32 |
# File 'lib/action_dispatch/routing/json_formatter.rb', line 31 def no_routes end |
#result ⇒ Object
Serialize the buffer has as json
14 15 16 |
# File 'lib/action_dispatch/routing/json_formatter.rb', line 14 def result ActiveSupport::JSON.encode(@buffer) end |
#section(routes) ⇒ Object
22 23 24 |
# File 'lib/action_dispatch/routing/json_formatter.rb', line 22 def section(routes) @buffer.merge! draw_section(routes) end |
#section_title(title) ⇒ Object
No need for a title, we only want the data
19 20 |
# File 'lib/action_dispatch/routing/json_formatter.rb', line 19 def section_title(title) end |