Skip to content
This repository
Browse code

Rakefile: Tweak OpenStruct binding for 1.9 compat.

  • Loading branch information...
commit a827ba0acaec90604f60edeaa1d53bab251bca61 1 parent 3aa5906
runpaint authored

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. +5 5 Rakefile
10 Rakefile
@@ -2,6 +2,10 @@ require 'rake/clean'
2 2 require 'hpricot'
3 3 require 'erb'
4 4
  5 +class OpenStruct
  6 + def bind; binding; end
  7 +end
  8 +
5 9 WEB_OUT = 'output/www'
6 10 OFFLINE_OUT = 'output/offline'
7 11 SOURCE_HTML = FileList['text/**/*.html']
@@ -14,13 +18,9 @@ TEMPLATES_DIR = 'templates/'
14 18 TEMPLATE_WRAPPER = 'page.html'
15 19 TEMPLATE_NO_WRAP = [TEMPLATE_WRAPPER, 'atom.atom']
16 20
17   -def bind(obj)
18   - obj.send(:binding)
19   -end
20   -
21 21 def template(filename,hash)
22 22 content = ERB.new(File.open(File.join(TEMPLATES_DIR,filename)).read).
23   - result(bind(OpenStruct.new(hash)))
  23 + result(OpenStruct.new(hash).bind)
24 24 return content if TEMPLATE_NO_WRAP.include? filename
25 25 template(TEMPLATE_WRAPPER, {:content => content}.merge(hash))
26 26 end

0 comments on commit a827ba0

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