te_reo_maori 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +2 -0
- data/exe/te_reo_maori +2 -1
- data/lib/te_reo_maori/tau.rb +1 -1
- data/lib/te_reo_maori/version.rb +1 -1
- data/lib/te_reo_maori/whakahua.rb +29 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c8a52e8d2878c16777d0c9dc0dd55f8e6bd06ab3cdba4d80b5a39848ef84668
|
4
|
+
data.tar.gz: d9e823fbc6fd89bfb00dd8ef07448224da8184eb026bb5e8d6c5cd17113f4eb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3347d474bcfdae117be822b4e7c767d698de58bf92e171db70822ab1e2cab34492c9a804494bc35c2424259e14ec124c0df9ec4b8569b615b27acc008fd37ed
|
7
|
+
data.tar.gz: af33af46aa99029683bd2e3cdc79322720a31072bb824d9962c21eb4e9b978d380bfccaede06894d1d4ba3db02f867429b8ad8c27e0118a5eeac1ab91bf78968
|
data/ChangeLog
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
* 0.1.4 - Pronounce integers on inspection for better terminal experience
|
2
|
+
- Handle up to 999 and accent marks
|
1
3
|
* 0.1.3 Bug fix. 'Whakahua' did not handle 'iwa' and numbers like toru tekau
|
2
4
|
* 0.1.2 whakahua method to pronounce numbers
|
3
5
|
* 0.1.1 Has docker image. Handle up to 99
|
data/exe/te_reo_maori
CHANGED
@@ -18,8 +18,9 @@ puts 'The numbers are: '
|
|
18
18
|
Tau.rarangi.each do |tau, whakamaoritanga|
|
19
19
|
puts "#{tau}: #{whakamaoritanga}"
|
20
20
|
end
|
21
|
+
puts 'If you type a number and press you will see Maori equivalent. Numbers > 10 must be wrapped in (). Greatest supported is 999'
|
21
22
|
puts 'Example of bigger numbers. 12: "tekau ma rua". Add 23 + 33: "(rua tekau ma toru) + (toru tekau ma toru)"'
|
22
|
-
puts '
|
23
|
+
puts 'See integer form by calling "to_s", e.g., "((rua tekau ma toru) + (toru tekau ma toru)).to_s" '
|
23
24
|
puts 'If you have any ideas on how this can be improved add issue to https://gitlab.com/samuel-garratt/te_reo_maori/-/issues'
|
24
25
|
|
25
26
|
IRB.start(__FILE__)
|
data/lib/te_reo_maori/tau.rb
CHANGED
@@ -13,7 +13,7 @@ module Tau
|
|
13
13
|
# List numbers
|
14
14
|
def self.rarangi
|
15
15
|
{
|
16
|
-
1 => 'tahi', 2 => 'rua', 3 => 'toru', 4 => '
|
16
|
+
1 => 'tahi', 2 => 'rua', 3 => 'toru', 4 => 'whā', 5 => 'rima', 6 => 'ono', 7 => 'waru',
|
17
17
|
8 => 'iwa', 9 => 'iwa', 10 => 'tekau'
|
18
18
|
}
|
19
19
|
end
|
data/lib/te_reo_maori/version.rb
CHANGED
@@ -2,24 +2,45 @@
|
|
2
2
|
|
3
3
|
# Extension to Integer for Maori
|
4
4
|
class Integer
|
5
|
+
def inspect
|
6
|
+
whakahua
|
7
|
+
end
|
8
|
+
|
9
|
+
# @param [Integer] upper_part Integer of number of 100s
|
10
|
+
# @param [String] lower_part Already translated part less than 100
|
11
|
+
def add_parts(upper_part, lower_part)
|
12
|
+
if upper_part == 0
|
13
|
+
lower_part
|
14
|
+
elsif upper_part == 1
|
15
|
+
"kotahi rau #{lower_part}"
|
16
|
+
else
|
17
|
+
"#{upper_part.whakahua} rau #{lower_part}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
5
21
|
# Pronounce number
|
6
22
|
def whakahua
|
7
|
-
raise NotImplementedError,
|
23
|
+
raise NotImplementedError, "Amount of #{self} implemented yet" if self > 999 || self < 1
|
24
|
+
return 'kotahi rau' if self == 100
|
25
|
+
|
26
|
+
lower_part = self % 100
|
27
|
+
upper_part = self / 100
|
8
28
|
|
9
|
-
last_digit =
|
29
|
+
last_digit = lower_part % 10
|
10
30
|
last_digit_word = Tau.rarangi[last_digit]
|
11
31
|
|
12
|
-
first_digit = (
|
32
|
+
first_digit = (lower_part / 10)
|
13
33
|
if first_digit.positive?
|
14
34
|
if last_digit.zero?
|
15
|
-
return 'tekau' if first_digit == 1
|
16
|
-
|
35
|
+
return add_parts(upper_part, 'tekau') if first_digit == 1
|
36
|
+
|
37
|
+
return add_parts upper_part, "#{Tau.rarangi[first_digit]} tekau"
|
17
38
|
end
|
18
39
|
|
19
|
-
return "tekau
|
40
|
+
return add_parts upper_part, "tekau mā #{last_digit_word}" if first_digit == 1
|
20
41
|
|
21
|
-
return "#{Tau.rarangi[first_digit]} tekau
|
42
|
+
return add_parts upper_part, "#{Tau.rarangi[first_digit]} tekau mā #{last_digit_word}"
|
22
43
|
end
|
23
|
-
last_digit_word
|
44
|
+
add_parts upper_part, last_digit_word
|
24
45
|
end
|
25
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: te_reo_maori
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garratt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Tool to aid one to learn Maori and enable one to program in Maori.
|
14
14
|
email:
|