Class: Akki::Application

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/akki/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



9
10
11
# File 'lib/akki/application.rb', line 9

def context
  @context
end

Instance Method Details

#create_default_contextObject



11
12
13
14
# File 'lib/akki/application.rb', line 11

def create_default_context
  @context = Context.new
  @context.articles = Article.all
end

#render_article(article) ⇒ Object



51
52
53
# File 'lib/akki/application.rb', line 51

def render_article article
  haml article.content, :layout => false
end

#render_page(page = :index) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/akki/application.rb', line 42

def render_page page = :index
  if page.to_s.end_with? ".xml"
    content_type "application/xml"
    haml :"pages/#{page}", :layout => false, :format => :xhtml, :escape_html => true
  else
    haml :"pages/#{page}"
  end
end