Skip to content

Instantly share code, notes, and snippets.

@mooreniemi
Created May 4, 2016 22:40
Show Gist options
  • Save mooreniemi/b757af6b787f0203864ea4c605cc4838 to your computer and use it in GitHub Desktop.
Save mooreniemi/b757af6b787f0203864ea4c605cc4838 to your computer and use it in GitHub Desktop.
case to class
#!/usr/bin/env ruby
case ARGV[0]
when "one"
puts "hi"
when "two"
puts "bye"
else
puts "otherwise"
end
#!/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