From 969bbd39f435252f2838852aafd3aff5ff463b9e Mon Sep 17 00:00:00 2001 From: J Fern Date: Tue, 12 Nov 2019 02:40:11 +0000 Subject: [PATCH] Done. --- application.rb | 2 +- first.ru | 9 +++++++++ my_server.rb | 9 +++++++++ second.ru | 15 +++++++++++++++ third.ru | 2 ++ 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 first.ru create mode 100644 my_server.rb create mode 100644 second.ru create mode 100644 third.ru diff --git a/application.rb b/application.rb index b5bfe335..f62b9881 100644 --- a/application.rb +++ b/application.rb @@ -2,7 +2,7 @@ class Application def call(env) resp = Rack::Response.new - resp.write "Hello, World" + resp.write "Hello, my name is" resp.finish end diff --git a/first.ru b/first.ru new file mode 100644 index 00000000..5d9140fc --- /dev/null +++ b/first.ru @@ -0,0 +1,9 @@ +require 'rack' + + + +my_server = Proc.new do + [200, {'Content-Type' => 'text/html'},['Hello my web app example']] +end + +run my_server \ No newline at end of file diff --git a/my_server.rb b/my_server.rb new file mode 100644 index 00000000..1bc2f1d1 --- /dev/null +++ b/my_server.rb @@ -0,0 +1,9 @@ +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 third example class/rb and ru files"] + end +end \ No newline at end of file diff --git a/second.ru b/second.ru new file mode 100644 index 00000000..82a24133 --- /dev/null +++ b/second.ru @@ -0,0 +1,15 @@ +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 \ No newline at end of file diff --git a/third.ru b/third.ru new file mode 100644 index 00000000..26123ec3 --- /dev/null +++ b/third.ru @@ -0,0 +1,2 @@ +require_relative './application' +run Application.new \ No newline at end of file