Skip to content

Instantly share code, notes, and snippets.

@eiel
Created November 29, 2012 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eiel/4165953 to your computer and use it in GitHub Desktop.
Save eiel/4165953 to your computer and use it in GitHub Desktop.
rack と erb の sample 初期状態
require 'rubygems'
require 'rack'
require 'erb'
class RackApp
def call(env)
[200, {'Content-Type' => 'text/html'}, [<<END_HTML]
<html>
<head><title>Rack test</title></head>
<body>
<h1>Rack test</h1>
<p>
<% (1..9).each do |y| %>
<%= y %>
<% end %>
<%(1..9).each do |x|%>
<%= x %>
<%(1..9).each do |y|%>
<%= x * y %>
<% end %>
<% end %>
</p>
</body>
</html>
END_HTML
end
end
require './rack_test.rb'
run RackApp.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment