RubyでHello World

(20)
https://techacademy.jp/magazine/19901


apt install ruby-full
ruby --version

vim hello.rb
print "Hello World!\n"

ruby hello.rb

--
vim web.rb

require 'webrick'
op = { BindAddress: "192.168.137.167", Port: 8080, DocumentRoot: "." }
s = WEBrick::HTTPServer.new(op)
s.start

vim index.html
<!DOCTYPE html>
<html>
<body>
<h1>Hello World</h1>
</body>
</html>

ruby web.rb

 

(10)

apt install ruby-full
ruby --version

vim hello.rb
print "Hello World!\n"

ruby hello.rb

--
vim web.rb

require 'webrick'
op = { BindAddress: "192.168.137.156", Port: 8080, DocumentRoot: "." }
s = WEBrick::HTTPServer.new(op)
s.start

vim index.html
<!DOCTYPE html>
<html>
<body>
<h1>Hello World</h1>
</body>
</html>

ruby web.rb

 

 

(8)

dnf install ruby
ruby --version

vim hello.rb
print "Hello World!\n"

ruby hello.rb

--
vim web.rb

require 'webrick'
op = { BindAddress: "192.168.137.165", Port: 8080, DocumentRoot: "." }
s = WEBrick::HTTPServer.new(op)
s.start

vim index.html
<!DOCTYPE html>
<html>
<body>
<h1>Hello World</h1>
</body>
</html>

ruby web.rb

 

(2019)

https://rubyinstaller.org/downloads/
ruby --version

notepad hello.rb
print "Hello World!\n"

ruby hello.rb

--
notepad web.rb

require 'webrick'
op = { BindAddress: "192.168.137.160", Port: 8080, DocumentRoot: "." }
s = WEBrick::HTTPServer.new(op)
s.start

notepad index.html
<!DOCTYPE html>
<html>
<body>
<h1>Hello World</h1>
</body>
</html>

ruby web.rb