Class: ActionDispatch::Routing::JSONFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/routing/json_formatter.rb

Instance Method Summary collapse

Constructor Details

#initializeJSONFormatter

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_routesObject

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

#resultObject

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