Module: Apitome::DocsHelper

Defined in:
app/helpers/apitome/docs_helper.rb

Instance Method Summary collapse

Instance Method Details



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

Returns:

  • (Boolean)


16
17
18
# File 'app/helpers/apitome/docs_helper.rb', line 16

def link_active?(link)
  current_page?(url_for(link))
end


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