Sha256: bf57dbf8c69b8a041e669af637096197aa572408da4a05fc6de24e4b2f713253

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

module Apitome::DocsHelper
  def format_scope(scope)
    Array(scope).each_with_index.map do |scope, index|
      if index == 0
        scope
      else
        "[#{scope}]"
      end
    end.join
  end

  def resource_link(resource)
    "#{Apitome.configuration.mount_at}/#{resource['examples'].first['link'].gsub(/\.json$/, '')}"
  end

  def example_link(example)
    "#{Apitome.configuration.mount_at}/#{example['link'].gsub(/\.json$/, '')}"
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apitome-0.2.1 app/helpers/apitome/docs_helper.rb
apitome-0.2.0 app/helpers/apitome/docs_helper.rb