Skip to content

Instantly share code, notes, and snippets.

@vtypal
Created July 17, 2009 11:49
Show Gist options
  • Save vtypal/149018 to your computer and use it in GitHub Desktop.
Save vtypal/149018 to your computer and use it in GitHub Desktop.
Innate::Request.current.env
require 'rubygems'
require 'innate'
class Demo
include Innate::Node
map '/'
provide :html, :engine => :Etanni, :type => 'text/html'
@@header =<<-HEADER
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>#{@title}</title>
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Innate Request Example." />
<meta name="generator" content="Innate #{Innate::VERSION}" />
<meta name="author" content="vtypal_at_gmail_com" />
<meta name="keywords" content="innate, example, request, env" />
<meta name="date" content="#{Time.now.iso8601}" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen"/>
<title>#{@title}</title>
</head>
<body>
HEADER
@@footer =<<-FOOTER
</body>
</html>
FOOTER
def index
@title = "Innate Request ENV"
@current = Innate::Request.current
@@header + %|
I N N A T E - R E Q U E S T - E N V<br />
<p><strong>Innate::Request.current.env</strong> is a hash with the following available keys:<br />
<?r @current.env.each_key do \|k\| ?>
#\{k} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?r end ?>
</p>
<p>
Your env values in your current request are (this is what your browser sends to the server):<br />
<?r @current.env.each_key do \|k\| ?>
#\{k} : #\{@current.env[k]} <br />
<?r end ?>
</p>
| + @@footer
end
end
ENV['ads'] = 'false'
Innate.options.mode = :dev
Innate.options.adapter.port = 7000
Innate.options.adapter.handler = :webrick
Innate.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment