Created
May 4, 2016 22:40
-
-
Save mooreniemi/b757af6b787f0203864ea4c605cc4838 to your computer and use it in GitHub Desktop.
case to class
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
#!/usr/bin/env ruby | |
case ARGV[0] | |
when "one" | |
puts "hi" | |
when "two" | |
puts "bye" | |
else | |
puts "otherwise" | |
end |
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
#!/usr/bin/env ruby | |
class App | |
def one | |
puts "hi" | |
end | |
def two | |
puts "bye" | |
end | |
def method_missing(method, args = []) | |
puts "otherwise" | |
end | |
end | |
App.send(ARGV[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment