genki (owner)

Revisions

gist: 148489 Download_button fork
public
Public Clone URL: git://gist.github.com/148489.git
Embed All Files: show embed
gist_require.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
module Gist
module_function
  def require(id, sha1 = "HEAD")
    Kernel.require "open-uri"
    uri = if sha1 == "HEAD"
      "http://gist.github.com/#{id}.txt"
    else
      "http://gist.github.com/raw/#{id}/#{sha1}"
    end
    eval open(uri).read
  end
end