This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # my_rack_mtd.rb | |
| require 'rack' | |
| def string_reverse env | |
| if ARGV[0].class == NilClass | |
| [400, {}, ["Input string missing"]] | |
| else | |
| final_str = "" | |
| str_arry = ARGV[0].to_s.reverse.split | |
| str_arry.each do |str| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def display(number) | |
| print "The number you entered on the command line is " | |
| if number < 0 | |
| puts "negative" | |
| elsif number > 0 | |
| puts "positive" | |
| else | |
| puts "zero" | |
| end | |
| end |