Module: Apitome::DocsHelper
- Defined in:
- app/helpers/apitome/docs_helper.rb
Instance Method Summary collapse
- #example_link(example) ⇒ Object
- #format_scope(scopes) ⇒ Object
- #link_active?(link) ⇒ Boolean
- #resource_link(resource) ⇒ Object
Instance Method Details
#example_link(example) ⇒ Object
12 13 14 |
# File 'app/helpers/apitome/docs_helper.rb', line 12 def example_link(example) "#{Apitome.configuration.mount_at}/#{CGI.escape(example['link'].gsub(/\.json$/, ''))}" end |
#format_scope(scopes) ⇒ Object
2 3 4 5 6 |
# File 'app/helpers/apitome/docs_helper.rb', line 2 def format_scope(scopes) Array(scopes).each_with_index.map do |scope, index| index == 0 ? scope : "[#{scope}]" end.join end |
#link_active?(link) ⇒ Boolean
16 17 18 |
# File 'app/helpers/apitome/docs_helper.rb', line 16 def link_active?(link) current_page?(url_for(link)) end |
#resource_link(resource) ⇒ Object
8 9 10 |
# File 'app/helpers/apitome/docs_helper.rb', line 8 def resource_link(resource) "#{Apitome.configuration.mount_at}/#{CGI.escape(resource['examples'].first['link'].gsub(/\.json$/, ''))}" end |