module ApiCanon

Constants

VERSION

Public Class Methods

included(base) click to toggle source
# File lib/api_canon.rb, line 26
def self.included(base)
  base.extend(ClassMethods)
  base.class_eval do
    append_view_path File.join(File.dirname(__FILE__),'..','app','views')
    require 'helpers/api_canon/api_canon_view_helper'
    helper ApiCanon::ApiCanonViewHelper
  end
end

Public Instance Methods

api_canon_docs() click to toggle source
# File lib/api_canon.rb, line 35
def api_canon_docs
  @api_doc = DocumentationStore.fetch controller_path
  respond_to do |format|
    format.html { render 'api_canon/api_canon', :layout => 'layouts/api_canon' }
  end
end
index() click to toggle source

When this module is included, your index method is overwritten with this one, which renders the ApiCanon documentation if params is html, and defaults to the existing method otherwise.

Calls superclass method
# File lib/api_canon.rb, line 45
def index
  if request.format.html?
    api_canon_docs
  else
    super
  end
end