cfurrow
11/23/2010 - 8:23 PM

app.rb

# file is in /plugins/gist_helper/lib/gist_helper.rb

require 'sinatra/base'

module Sinatra
  module GistHelper
    def gist(gn)
      "<script type='text/javascript' src='https://gist.github.com/#{gn}.js'></script>"
    end
  end

  helpers GistHelper
end
date: 2010/11/23 3:25pm

%h1 Some Article

= gist(12345) #=> Should return a <script> block, for the gist with id 12345
# ... snipped
Nesta::Plugins.load_local_plugins #=> Should load gist_helper.rb, below

module Nesta
  class App < Sinatra::Base
    register Sinatra::Cache

    set :root, File.dirname(__FILE__)
    set :cache_enabled, Config.cache

    helpers Sinatra::GistHelper #=> Required, according to http://www.sinatrarb.com/extensions.html
# ... snipped