te_reo_maori 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +1 -0
- data/README.md +14 -2
- data/exe/te_reo_maori +3 -1
- data/lib/te_reo_maori/tau.rb +10 -2
- data/lib/te_reo_maori/version.rb +1 -1
- data/lib/te_reo_maori/whakahua.rb +22 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea1d05343bd752d42bd5a3bbc0fcf4bfd5da4f3155a823141f87168cf30ef91
|
4
|
+
data.tar.gz: 78bdb847c7172cf11d63998c6155610894e965ebb66367ac1d7ac1dd7204bc93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97b24cc3ab1e0620e83e35ce9edbffbf3d86247c8be309799b4577e1a82ecb4f1f9f440536652421eaad71c501223eef05f0657e399036e0161a3545cf5eb57e
|
7
|
+
data.tar.gz: c441af3e82c6b222f2577df0506b211c5276a392564688b1bb0c090fde62d751dbe3c48b25bcd702a0f660a82b3aeeabe614fdc92881061e36792fc2d771f1f4
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,12 @@ Tool to aid one to learn Maori and enable one to program in Maori.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
+
Execute interactive terminal in docker
|
8
|
+
|
9
|
+
`docker run --rm -it registry.gitlab.com/samuel-garratt/te_reo_maori:latest`
|
10
|
+
|
11
|
+
### As a ruby gem
|
12
|
+
|
7
13
|
Add this line to your application's Gemfile:
|
8
14
|
|
9
15
|
```ruby
|
@@ -25,8 +31,14 @@ Count in maori
|
|
25
31
|
```ruby
|
26
32
|
tahi + rua
|
27
33
|
# Will give a result of 3
|
34
|
+
3.whakahua
|
35
|
+
# Will return 'toru'
|
36
|
+
whakahua(tahi + tahi)
|
37
|
+
# Will return 'rua'
|
28
38
|
```
|
29
39
|
|
40
|
+
Execute in interactive terminal. After installing type `te_reo_maori` on command prompt to open it.
|
41
|
+
|
30
42
|
## Development
|
31
43
|
|
32
44
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -35,7 +47,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
35
47
|
|
36
48
|
## Contributing
|
37
49
|
|
38
|
-
Bug reports and pull requests are welcome on GitLab at https://
|
50
|
+
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/samuel-garratt/te_reo_maori. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/samuel-garratt/te_reo_maori/blob/master/CODE_OF_CONDUCT.md).
|
39
51
|
|
40
52
|
|
41
53
|
## License
|
@@ -44,4 +56,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
44
56
|
|
45
57
|
## Code of Conduct
|
46
58
|
|
47
|
-
Everyone interacting in the TeReoMaori project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://
|
59
|
+
Everyone interacting in the TeReoMaori project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/samuel-garratt/te_reo_maori/blob/master/CODE_OF_CONDUCT.md).
|
data/exe/te_reo_maori
CHANGED
@@ -18,6 +18,8 @@ puts 'The numbers are: '
|
|
18
18
|
Tau.rarangi.each do |tau, whakamaoritanga|
|
19
19
|
puts "#{tau}: #{whakamaoritanga}"
|
20
20
|
end
|
21
|
-
puts 'Example of bigger numbers. 12:
|
21
|
+
puts 'Example of bigger numbers. 12: "tekau ma rua". Add 23 + 33: "(rua tekau ma toru) + (toru tekau ma toru)"'
|
22
|
+
puts 'To pronounce numbers one can use. "5.whakahua" or "whakahua((toru tekau ma tahi) + wha))"'
|
23
|
+
puts 'If you have any ideas on how this can be improved add issue to https://gitlab.com/samuel-garratt/te_reo_maori/-/issues'
|
22
24
|
|
23
25
|
IRB.start(__FILE__)
|
data/lib/te_reo_maori/tau.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'whakahua'
|
4
|
+
|
3
5
|
# Number in Maori
|
4
6
|
module Tau
|
7
|
+
def whakahua(tau)
|
8
|
+
raise "Class '#{tau.class}' not implmemented" unless tau.is_a? Integer
|
9
|
+
|
10
|
+
tau.whakahua
|
11
|
+
end
|
12
|
+
|
5
13
|
# List numbers
|
6
14
|
def self.rarangi
|
7
15
|
{
|
8
|
-
|
9
|
-
|
16
|
+
1 => 'tahi', 2 => 'rua', 3 => 'toru', 4 => 'wha', 5 => 'rima', 6 => 'ono', 7 => 'waru',
|
17
|
+
8 => 'iwa', 10 => 'tekau'
|
10
18
|
}
|
11
19
|
end
|
12
20
|
|
data/lib/te_reo_maori/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Extension to Integer for Maori
|
4
|
+
class Integer
|
5
|
+
# Pronounce number
|
6
|
+
def whakahua
|
7
|
+
raise NotImplementedError, 'Pronounciation not implemented yet' if self > 99
|
8
|
+
|
9
|
+
last_digit = self % 10
|
10
|
+
last_digit_word = Tau.rarangi[last_digit]
|
11
|
+
|
12
|
+
first_digit = (self / 10)
|
13
|
+
if first_digit.positive?
|
14
|
+
return 'tekau' if last_digit.zero?
|
15
|
+
|
16
|
+
return "tekau ma #{last_digit_word}" if first_digit == 1
|
17
|
+
|
18
|
+
return "#{Tau.rarangi[first_digit]} tekau ma #{last_digit_word}"
|
19
|
+
end
|
20
|
+
last_digit_word
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garratt
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- lib/te_reo_maori.rb
|
35
35
|
- lib/te_reo_maori/tau.rb
|
36
36
|
- lib/te_reo_maori/version.rb
|
37
|
+
- lib/te_reo_maori/whakahua.rb
|
37
38
|
- te_reo_maori.gemspec
|
38
39
|
homepage: https://gitlab.com/samuel-garratt/te_reo_maori
|
39
40
|
licenses:
|