Sha256: 19f0d17ccb16ee9c011fd6be119f40383b0724e2acc34448ff2a8a83640d2155
Contents?: true
Size: 750 Bytes
Versions: 10
Compression:
Stored size: 750 Bytes
Contents
module Ixtlan class CmsScript def initialize(app, rootpath = "/ixtlan") @app = app @rootpath = rootpath end def call(env) dup._call(env) end def _call(env) if(env['REQUEST_PATH'] =~ /^#{@rootpath}\//) file = Rails.public_path.to_s + env['REQUEST_PATH'].sub(/^#{@rootpath}/, '') @file = File.open(file) [@status, {}, self] else @app.call(env) end end def each(&block) @file.each do |line| block.call(line.sub(/<\/head>/, "<link type='text/css' rel='stylesheet' href='#{@rootpath}/embed.css'></link><script type='text/javascript' language='javascript' src='#{@rootpath}/embed.nocache.js'></script></head>")) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems