1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/vendor/erb/lib/erb.rb
blake.mizerany@gmail.com 72be291da2 this is it
2007-09-08 23:51:24 +00:00

27 lines
463 B
Ruby

require 'erb'
module Sinatra
module Erb
module InstanceMethods
def erb(content)
s = if content.is_a?(Symbol)
open("%s/%s.erb" % [views_dir, content]).read
else
content
end
body ERB.new(s).result(binding)
end
def views_dir(value = nil)
@views_dir = value if value
@views_dir || File.dirname($0) + '/views'
end
end
end
end