Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rack'
- require 'rack/server'
- class HelloRackApp
- def self.call(env)
- # langs = ["ruby", "php", "python", "ruby", "python"]
- # str = langs.inject(Hash.new(0)) { |freqs, lang| freqs.update(lang => 1) { |key, o, n| o + n } }.inspect
- max_val, max_index = 0
- salary = [50_000, 53_000, 100_000, 73_000, 100_000]
- salary.each_with_index do |val, index|
- if val >= max_val
- max_val = val
- max_index = index
- end
- end
- [200, { 'Content-Type' => 'text/html' }, [max_index]]
- end
- end
- Rack::Server.start({ app: HelloRackApp })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement