-
-
Save akira345/4166004 to your computer and use it in GitHub Desktop.
rack と erb の sample 初期状態
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
次のcommitでなおせばいいやっておもったんだけどそれかっこの位置違う。