class Arigato::View

Constants

TITLE

Attributes

layout[RW]
specs[RW]
theme[RW]
title[RW]

Public Class Methods

author(spec) click to toggle source
# File lib/arigato/view.rb, line 62
def self.author(spec)
  spec.author ? "by #{spec.author}" : ''
end
new(theme, gemfile = './Gemfile', layout = true) click to toggle source
# File lib/arigato/view.rb, line 10
def initialize(theme, gemfile = './Gemfile', layout = true) 
  @theme = theme
  @specs = Arigato.specs(gemfile)
  @layout = layout
  @title = TITLE
end

Public Instance Methods

content() click to toggle source
# File lib/arigato/view.rb, line 29
def content
  erb(content_file).result(binding)
end
content_file() click to toggle source
# File lib/arigato/view.rb, line 47
def content_file
  file('content')
end
content_for(title = nil) click to toggle source
# File lib/arigato/view.rb, line 59
def content_for(title = nil)
end
erb(path) click to toggle source
# File lib/arigato/view.rb, line 37
def erb(path)
  erb = ERB.new(File.read(path), nil, '-')
  erb.filename = path
  erb 
end
layout_file() click to toggle source
# File lib/arigato/view.rb, line 51
def layout_file
  file('layout')
end
render() click to toggle source
# File lib/arigato/view.rb, line 17
def render 
  @layout ? render_with_layout : render_without_layout
end
render_with_layout() click to toggle source
# File lib/arigato/view.rb, line 25
def render_with_layout
  layout
end
render_without_layout() click to toggle source
# File lib/arigato/view.rb, line 21
def render_without_layout
  content
end
theme_dir() click to toggle source
# File lib/arigato/view.rb, line 43
def theme_dir
  Pathname.new(File.join(Arigato.themes_dir, theme))
end

Private Instance Methods

file(name) click to toggle source
# File lib/arigato/view.rb, line 68
def file(name)
  File.join(theme_dir, "#{name}.html.erb")
end