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
# -*- coding: utf-8 -*- | |
class SimpleApp | |
def call(env) | |
p env | |
case env['REQUEST_METHOD'] | |
when 'GET' | |
[ | |
200, | |
{ 'Content-Type' => 'text/html' }, | |
['<html><body><form method="POST"><input type="submit" value="want to see?" /></form></body></html>'] |
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 './test.rb' | |
run(SimpleApp.new) |
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
# -*- coding: utf-8 -*- | |
class SimpleApp | |
def call(env) | |
p env | |
case env['REQUEST_METHOD'] | |
when 'GET' | |
[ | |
200, | |
{ 'Content-Type' => 'text/html' }, | |
['<html><body><form method="POST"><input type="submit" value="want to see?" /></form></body></html>'] |
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
a |
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
# Bridge パターン | |
# | |
# Java言語で学ぶデザインパターンと同様の例題をRubyで記述した。 | |
# | |
# coded by Takehiro Kaga | |
# | |
class Display | |
def initialize(impl) | |
@impl = impl |
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
class Display | |
def initialize(impl) | |
@impl = impl | |
end | |
def open | |
@impl.rawOpen | |
end | |
def printf | |
@impl.rawPrint |
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
+-------------+ | |
|Hello, Japan.| | |
+-------------+ | |
(Hello, World.) | |
(Hello, Universe.) | |
+------+ | |
|Hello!| | |
+------+ | |
() | |
(Hello, Universe.Hello, Universe.Hello, Universe.Hello, Universe.Hello, Universe.) |
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
+-------------+ | |
|Hello, Japan.| | |
+-------------+ | |
+-------------+ | |
|Hello, World.| | |
+-------------+ | |
+----------------+ | |
|Hello, Universe.| | |
+----------------+ | |
+----------------+ |
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
class Display | |
def initialize(impl) @impl = impl end | |
def open @impl.rawOpen end | |
def printf @impl.rawPrint end | |
def close @impl.rawClose end | |
def display | |
open | |
printf | |
close | |
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
class Display | |
def initialize(impl) @impl = impl end | |
def open @impl.rawOpen end | |
def printf @impl.rawPrint end | |
def close @impl.rawClose end | |
def display | |
open | |
printf | |
close | |
end |
OlderNewer