Method: Kernel#fail

Defined in:
lib/tokyo/core_ext.rb

#fail(*reason) ⇒ Object

stop executing any code and report a failure

Examples:

x > y || fail('x should be greater than y')

Parameters:

  • reason


99
100
101
102
# File 'lib/tokyo/core_ext.rb', line 99

def fail *reason
  reason.empty? && raise(ArgumentError, 'Wrong number or arguments, 0 for 1+')
  Tokyo.fail(reason.flatten, caller[0])
end