Sha256: 9e42688bec6ec5c3c56a73f9b7cd6f107de7b9aa480ca4aac8565c5df874ec7b

Contents?: true

Size: 544 Bytes

Versions: 1

Compression:

Stored size: 544 Bytes

Contents

# frozen_string_literal: true

# Extension to Integer for Maori
class Integer
  # Pronounce number
  def whakahua
    raise NotImplementedError, 'Pronounciation not implemented yet' if self > 99

    last_digit = self % 10
    last_digit_word = Tau.rarangi[last_digit]

    first_digit = (self / 10)
    if first_digit.positive?
      return 'tekau' if last_digit.zero?

      return "tekau ma #{last_digit_word}" if first_digit == 1

      return "#{Tau.rarangi[first_digit]} tekau ma #{last_digit_word}"
    end
    last_digit_word
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
te_reo_maori-0.1.2 lib/te_reo_maori/whakahua.rb