diff --git a/first.ru b/first.ru new file mode 100644 index 00000000..04580029 --- /dev/null +++ b/first.ru @@ -0,0 +1,10 @@ +require 'rack' + +my_server = Proc.new do + [200, {'Content-Type' => 'text/html'}, +['Hello Neil!'] + ] + +end + +run my_server diff --git a/my_server.rb b/my_server.rb new file mode 100644 index 00000000..0d3fccea --- /dev/null +++ b/my_server.rb @@ -0,0 +1,11 @@ +class MyServer + + def call(env) + return [200, {'Content-Type' => 'text/html'}, pretty_response] + end + + def pretty_response + (Time.now.to_i % 2).zero? ? ["Hello"] : ["Hello Neil"] + end + +end diff --git a/second.ru b/second.ru new file mode 100644 index 00000000..fdeb11a3 --- /dev/null +++ b/second.ru @@ -0,0 +1,13 @@ +require 'rack' + +class MyServer + def call(env) + return [200, {'Content-Type' => 'text/html'}, pretty_response] + end + + def pretty_response + (Time.now.to_i % 2).zero? ? ["Hello"] : ["Hello"] + end +end + +run MyServer.new diff --git a/third.ru b/third.ru new file mode 100644 index 00000000..ab09a0f8 --- /dev/null +++ b/third.ru @@ -0,0 +1,2 @@ +require_relative './my_server' +run MyServer.new