Skip to content

Commit

Permalink
[change] 'public_html/index.cgi' to rename 'ERUBY' to '$ERUBIS_CLASS'
Browse files Browse the repository at this point in the history
  • Loading branch information
kwatch committed Mar 19, 2011
1 parent 66fb830 commit 660ea94
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions public_html/index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## configuration
$ENCODING = nil
$LAYOUT = '_layout.rhtml'
$ERUBIS_CLASS = Erubis::Eruby # or Erubis::EscapeEruby

## load Erubis
begin
Expand Down Expand Up @@ -43,8 +44,6 @@ end
class ErubisHandler
include Erubis::XmlHelper

ERUBY = Erubis::Eruby # or Erubis::EscapeEruby

def initialize
@encoding = $ENCODING
@layout = $LAYOUT
Expand All @@ -68,13 +67,13 @@ class ErubisHandler
basepath != env['SCRIPT_NAME'] or # can't access to index.cgi
raise HttpError.new(403, "#{basepath}: not accessable.")
## process as eRuby file
#eruby = ERUBY.new(File.read(filepath)) # not create cache file (slower)
eruby = ERUBY.load_file(filepath) # create cache file (faster)
#eruby = $ERUBIS_CLASS.new(File.read(filepath)) # not create cache file (slower)
eruby = $ERUBIS_CLASS.load_file(filepath) # create cache file (faster)
html = eruby.evaluate(self)
## use layout template
if @layout && File.file?(@layout)
@content = html
html = ERUBY.load_file(@layout).evaluate(self)
html = $ERUBIS_CLASS.load_file(@layout).evaluate(self)
end
return html
end
Expand Down

0 comments on commit 660ea94

Please sign in to comment.