Class: Opalla::Util::JsFormatter
- Inherits:
-
Object
- Object
- Opalla::Util::JsFormatter
- Defined in:
- lib/opalla/util.rb
Instance Method Summary collapse
- #header(routes) ⇒ Object
-
#initialize ⇒ JsFormatter
constructor
A new instance of JsFormatter.
- #result ⇒ Object
- #section(routes) ⇒ Object
Constructor Details
#initialize ⇒ JsFormatter
Returns a new instance of JsFormatter.
13 14 15 |
# File 'lib/opalla/util.rb', line 13 def initialize @buffer = [] end |
Instance Method Details
#header(routes) ⇒ Object
32 |
# File 'lib/opalla/util.rb', line 32 def header(routes); end |
#result ⇒ Object
17 18 19 |
# File 'lib/opalla/util.rb', line 17 def result @buffer end |
#section(routes) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/opalla/util.rb', line 21 def section(routes) @buffer = routes.each_with_object({}) do |r, memo| path = r[:path].gsub(/\(.:format\)/, '') memo[r[:name]] = { verb: r[:verb], path: path, reqs: r[:reqs] } end end |