Module: StaticDocs

Defined in:
lib/static_docs.rb,
lib/static_docs/engine.rb,
lib/static_docs/version.rb,
lib/static_docs/importer.rb,
app/models/static_docs/page.rb,
app/helpers/static_docs/pages_helper.rb,
app/helpers/static_docs/application_helper.rb,
app/controllers/static_docs/pages_controller.rb,
app/controllers/static_docs/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, PagesHelper Classes: ApplicationController, Engine, Importer, Page, PagesController

Constant Summary collapse

VERSION =
"0.2.1"
@@sources =
{}.with_indifferent_access
@@renderers =
{
  :default => {
    :html => proc{ |body| body.html_safe },
    :txt => proc{ |body| body }
  }.with_indifferent_access
}.with_indifferent_access

Class Method Summary collapse

Class Method Details

.namespacesObject



30
31
32
# File 'lib/static_docs.rb', line 30

def self.namespaces
  @namespaces ||= sources.keys
end

.renderer(format, options = {}, &block) ⇒ Object



20
21
22
23
24
# File 'lib/static_docs.rb', line 20

def self.renderer(format, options = {}, &block)
  namespace = options[:namespace] || :default
  @@renderers[namespace] ||= {}.with_indifferent_access
  @@renderers[namespace][format] = block
end

.setup(&block) ⇒ Object



26
27
28
# File 'lib/static_docs.rb', line 26

def self.setup(&block)
  instance_eval(&block)
end

.source(src, options = {}) ⇒ Object



15
16
17
18
# File 'lib/static_docs.rb', line 15

def self.source(src, options = {})
  namespace = options[:namespace] || options[:to]
  @@sources[namespace] = src
end