module ToRupees::Utils
Public Instance Methods
higher_than_hundred(hundred, remaining, counter)
click to toggle source
# File lib/to_rupees/utils.rb, line 14 def higher_than_hundred(hundred, remaining, counter) century = UNDER_HUNDRED[hundred] if remaining != 0 return century + " hundred " + UNDER_HUNDRED[remaining] if counter != 0 return century + " hundred and " + UNDER_HUNDRED[remaining] end return century + " hundred " if remaining == 0 end
numerical?(num)
click to toggle source
# File lib/to_rupees/utils.rb, line 23 def numerical?(num) Integer(num) rescue raise "A numeric is expected" end
result_below_one_thousand(num, counter)
click to toggle source
# File lib/to_rupees/utils.rb, line 7 def result_below_one_thousand(num, counter) hundred, remaining = num.divmod(100) return higher_than_hundred(hundred, remaining, counter) if hundred != 0 UNDER_HUNDRED[remaining] if hundred == 0 && remaining != 0 end