Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/englishnepalidateconverter/extensions/integer.rb

Overview

Extension to Integer class to add Nepali number method

Constant Summary collapse

NEPALI_DIGITS =
{
  "0" => "०",
  "1" => "१",
  "2" => "२",
  "3" => "३",
  "4" => "४",
  "5" => "५",
  "6" => "६",
  "7" => "७",
  "8" => "८",
  "9" => "९"
}.freeze

Instance Method Summary collapse

Instance Method Details

#to_nepaliObject



18
19
20
# File 'lib/englishnepalidateconverter/extensions/integer.rb', line 18

def to_nepali
  to_s.chars.map { |c| NEPALI_DIGITS[c] || c }.join
end