class

ArgumentError

v1_9_1_378 - Show latest stable - Superclass: StandardError

No documentation available for this class.

Files

  • error.c

1Note

Use this!

Soleone ยท Feb 11, 20092 thanks

You should raise your own +ArgumentError+ in methods to notify users of your class, if you think certain kinds of arguments aren't acceptable.

def transfer_money(amount)
unless amount.is_a?(Number)
  raise ArgumentError.new("Only numbers are allowed")
end
# ... Do the actual work
end