Class: ActionDispatch::Routing::MarkdownFormatter
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::MarkdownFormatter
- Defined in:
- lib/utils/routes_formatter.rb
Instance Method Summary collapse
- #header(routes) ⇒ Object
-
#initialize(path = nil) ⇒ MarkdownFormatter
constructor
A new instance of MarkdownFormatter.
- #no_routes ⇒ Object
- #result ⇒ Object
- #section(routes) ⇒ Object
- #section_title(title) ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ MarkdownFormatter
Returns a new instance of MarkdownFormatter.
4 5 6 7 |
# File 'lib/utils/routes_formatter.rb', line 4 def initialize(path=nil) @buffer = [] @path = path end |
Instance Method Details
#header(routes) ⇒ Object
22 23 24 |
# File 'lib/utils/routes_formatter.rb', line 22 def header(routes) @buffer << draw_header(routes) end |
#no_routes ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/utils/routes_formatter.rb', line 26 def no_routes @buffer << <<~MESSAGE You don't have any routes defined! Please add some routes in config/routes.rb. For more information about routes, see the Rails guide: http://guides.rubyonrails.org/routing.html. MESSAGE end |
#result ⇒ Object
9 10 11 12 |
# File 'lib/utils/routes_formatter.rb', line 9 def result @buffer.join("\n") @buffer.reject(&:empty?) end |
#section(routes) ⇒ Object
18 19 20 |
# File 'lib/utils/routes_formatter.rb', line 18 def section(routes) @buffer << draw_section(routes) end |
#section_title(title) ⇒ Object
14 15 16 |
# File 'lib/utils/routes_formatter.rb', line 14 def section_title(title) @buffer << "" end |