Sha256: 3aa8b960605686c4317a010ab4830d4f10c949b89c4b9c957cb215a70c5c9faa

Contents?: true

Size: 765 Bytes

Versions: 9

Compression:

Stored size: 765 Bytes

Contents

class Knjappserver::ERBHandler
	def initialize
		@connected = {}
	end
	
	def erb_handler(data)
		#Hack the Knj::Thread to accept data - this is how get, post and etc. are set.
		Thread.current[:knjappserver] = data
		eruby = data[:httpsession].eruby
		
		if !@connected[eruby.__id__]
			eruby.connect("error") do |e|
				_kas.handle_error(e)
			end
			
			@connected[eruby.__id__] = true
		end
		
		cont = eruby.load_return(data[:filepath], {
			:with_headers => false,
			:custom_io => true
		})
		headers = eruby.headers
		eruby.reset_headers
		
		headers_ret = {}
		headers.each do |header|
			headers_ret[header[0]] = [header[1]]
		end
		
		Thread.current[:knjappserver].clear
    Thread.current[:knjappserver] = nil
		
    return {:headers => headers}
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knjappserver-0.0.15 lib/include/class_erbhandler.rb
knjappserver-0.0.14 lib/include/class_erbhandler.rb
knjappserver-0.0.13 lib/include/class_erbhandler.rb
knjappserver-0.0.12 lib/include/class_erbhandler.rb
knjappserver-0.0.11 lib/include/class_erbhandler.rb
knjappserver-0.0.10 lib/include/class_erbhandler.rb
knjappserver-0.0.9 lib/include/class_erbhandler.rb
knjappserver-0.0.8 lib/include/class_erbhandler.rb
knjappserver-0.0.6 lib/include/class_erbhandler.rb