Class: HelloWorld
- Inherits:
-
Object
- Object
- HelloWorld
- Defined in:
- lib/jnlp/rack_server.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(name) ⇒ HelloWorld
constructor
A new instance of HelloWorld.
Constructor Details
#initialize(name) ⇒ HelloWorld
Returns a new instance of HelloWorld.
4 5 6 |
# File 'lib/jnlp/rack_server.rb', line 4 def initialize(name) @name = name end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jnlp/rack_server.rb', line 8 def call(env) r = [ "<html><head><title>#{@name}</title></head>" + "<body><h2>#{@name}</h2><ul>" ] env.each_pair do |n, v| r << "<li><p>" r << "#{n} => #{v}" r << "</p></li>" end r << "</ul></body></html>" [200, { 'Content-Type' => 'text/html' }, r ] end |