Sha256: e53bfd7a606b24febdd1c5cb54f91dcdcdc5ed1e078f50655de2ef39cf63c604
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require 'arigato/version' module Arigato class View attr_accessor :theme, :layout, :gemfile, :title def initialize(theme, gemfile = './Gemfile', layout = true) @theme = theme @specs = Arigato.specs(gemfile) @layout = layout @title = 'Special Thanks' end def render @layout ? render_with_layout : render_without_layout end def render_without_layout content end def render_with_layout layout end def content erb(content_file).result(binding) end def layout erb(layout_file).result(binding) end def erb(path) erb = ERB.new(File.read(path), nil, '-') erb.filename = path erb end def theme_dir Pathname.new(File.join(Arigato.themes_dir, theme)) end def content_file file('content') end def layout_file file('layout') end def link_to(label, href, target = '_blank') if href %!<a href="#{href}" target="#{target}">#{label}</a>! else label end end def author(spec) spec.author ? "by #{spec.author}" : '' end private def file(name) File.join(theme_dir, "#{name}.html.erb") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arigato-0.1.1 | lib/arigato/view.rb |
arigato-0.1.0 | lib/arigato/view.rb |