Skip to content
Browse files

Rakefile: Tweak OpenStruct binding for 1.9 compat.

  • Loading branch information...
1 parent 3aa5906 commit a827ba0acaec90604f60edeaa1d53bab251bca61 @runpaint committed Jul 4, 2009
Showing with 5 additions and 5 deletions.
  1. +5 −5 Rakefile
View
10 Rakefile
@@ -2,6 +2,10 @@ require 'rake/clean'
require 'hpricot'
require 'erb'
+class OpenStruct
+ def bind; binding; end
+end
+
WEB_OUT = 'output/www'
OFFLINE_OUT = 'output/offline'
SOURCE_HTML = FileList['text/**/*.html']
@@ -14,13 +18,9 @@ TEMPLATES_DIR = 'templates/'
TEMPLATE_WRAPPER = 'page.html'
TEMPLATE_NO_WRAP = [TEMPLATE_WRAPPER, 'atom.atom']
-def bind(obj)
- obj.send(:binding)
-end
-
def template(filename,hash)
content = ERB.new(File.open(File.join(TEMPLATES_DIR,filename)).read).
- result(bind(OpenStruct.new(hash)))
+ result(OpenStruct.new(hash).bind)
return content if TEMPLATE_NO_WRAP.include? filename
template(TEMPLATE_WRAPPER, {:content => content}.merge(hash))
end

0 comments on commit a827ba0

Please sign in to comment.
Something went wrong with that request. Please try again.