Skip to content

Instantly share code, notes, and snippets.

@kyuden
Created November 4, 2013 09:32
Show Gist options
  • Save kyuden/7300213 to your computer and use it in GitHub Desktop.
Save kyuden/7300213 to your computer and use it in GitHub Desktop.
【WZ】<保持しないKeyで参照を行った場合のエラー処理付きhash> ・予期しない入力が起こった場合のエラー文言をカスタマイズしたい場合 ・CLIアプリなどで多様
hash = Hash.new do |hash, k|
raise( ArgumentError, "'#{k}' is not todo sub command" )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment