This is the shortest "hello {NAME}" Ruby program I could make. It fits in a tweet!
- Save it as "config.ru"
gem install rack- Run
rackup - Visit http://localhost:9292/?name=NAME
This is the shortest "hello {NAME}" Ruby program I could make. It fits in a tweet!
gem install rackrackup| run ->(e){ p=Hash[*e['QUERY_STRING'].split(/[&=]/)]; [200, {'Content-type'=>'text/html'}, ["Hello #{p['name']}!"]] } |
| # Of course, the same thing in Sinatra is way shorter! But I went for minimum dependencies above. | |
| require 'sinatra'; get('/') { "Hello #{params[:name]}!" } |