class ErrorHandle
require 'FizzBuzz'
Public Class Methods
check_defined(*_args)
click to toggle source
# File lib/error_handle.rb, line 29 def check_defined(*_args) start = defined?(:args[0]) stop = defined?(:args[1]) puts raise 'Invalid Data' unless !start.nil? && !stop.nil? true end
check_int(num)
click to toggle source
# File lib/error_handle.rb, line 36 def check_int(num) num.is_a?(Integer) end
check_is_num(*args)
click to toggle source
# File lib/error_handle.rb, line 15 def check_is_num(*args) unless check_int(args[0]) && check_int(args[1]) raise 'Enter Number Values only' end true end
check_no_of_arg(*args)
click to toggle source
# File lib/error_handle.rb, line 9 def check_no_of_arg(*args) raise 'Invalid no of Arguments' unless args.length == 2 true end
compare_num(*args)
click to toggle source
# File lib/error_handle.rb, line 23 def compare_num(*args) raise 'Enter a Valid Limit' unless args[0] < args[1] true end
error_check(*args)
click to toggle source
# File lib/error_handle.rb, line 5 def error_check(*args) check_no_of_arg(*args) && check_is_num(*args) && compare_num(*args) && check_defined(*args) end