te_reo_maori 0.1.2 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cea1d05343bd752d42bd5a3bbc0fcf4bfd5da4f3155a823141f87168cf30ef91
4
- data.tar.gz: 78bdb847c7172cf11d63998c6155610894e965ebb66367ac1d7ac1dd7204bc93
3
+ metadata.gz: 04cb8205736ee80d52825971f38bf50ad638b7fa3b734a30765ff29d319f6126
4
+ data.tar.gz: 560c00d171aa7659025a72ba3a92e08372b49e7513eedbc76165b8ee388892d9
5
5
  SHA512:
6
- metadata.gz: 97b24cc3ab1e0620e83e35ce9edbffbf3d86247c8be309799b4577e1a82ecb4f1f9f440536652421eaad71c501223eef05f0657e399036e0161a3545cf5eb57e
7
- data.tar.gz: c441af3e82c6b222f2577df0506b211c5276a392564688b1bb0c090fde62d751dbe3c48b25bcd702a0f660a82b3aeeabe614fdc92881061e36792fc2d771f1f4
6
+ metadata.gz: 90bb5856fd16765e987a081bcdb101c9fd85f08d807ab11dd14464c77c29365edf37ff28b34c870ec4434bf782794346e845cbc601f17d8e3388926ae9db9e3c
7
+ data.tar.gz: e64ddf6296e44ffb9340046040e409b9891a43e031d816933e44a21ac4e09cec1c0acb335ba90169aaf9dfa2de2848209384a644b1db5a5af33ea22671d490ee
data/.gitignore CHANGED
@@ -1,13 +1,13 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /.idea/
10
- Gemfile.lock
11
-
12
- # rspec failure tracking
13
- .rspec_status
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /.idea/
10
+ Gemfile.lock
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.gitlab-ci.yml CHANGED
@@ -1,28 +1,28 @@
1
- image: ruby:2.6
2
-
3
- test:
4
- before_script:
5
- - bundle install
6
- script:
7
- - rake
8
-
9
- include:
10
- - template: Code-Quality.gitlab-ci.yml
11
-
12
- docker_build:
13
- variables:
14
- # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
15
- DOCKER_HOST: tcp://docker:2376
16
- DOCKER_TLS_CERTDIR: "/certs"
17
- stage: deploy # Part of a later stage
18
- services:
19
- - docker:19.03.5-dind
20
- image: docker:19.03.5
21
- script:
22
- - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
23
- - docker pull --quiet $CI_REGISTRY_IMAGE:latest || true
24
- - docker build -t $CI_REGISTRY_IMAGE:latest .
25
- - docker push $CI_REGISTRY_IMAGE:latest
26
- only:
27
- - master
28
- needs: ["test"]
1
+ image: ruby:2.6
2
+
3
+ test:
4
+ before_script:
5
+ - bundle install
6
+ script:
7
+ - rake
8
+
9
+ include:
10
+ - template: Code-Quality.gitlab-ci.yml
11
+
12
+ docker_build:
13
+ variables:
14
+ # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
15
+ DOCKER_HOST: tcp://docker:2376
16
+ DOCKER_TLS_CERTDIR: "/certs"
17
+ stage: deploy # Part of a later stage
18
+ services:
19
+ - docker:19.03.5-dind
20
+ image: docker:19.03.5
21
+ script:
22
+ - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
23
+ - docker pull --quiet $CI_REGISTRY_IMAGE:latest || true
24
+ - docker build -t $CI_REGISTRY_IMAGE:latest .
25
+ - docker push $CI_REGISTRY_IMAGE:latest
26
+ only:
27
+ - master
28
+ needs: ["test"]
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,74 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at TODO: Write your email address. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at TODO: Write your email address. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
- * v 0.1.2 whakahua method to pronounce numbers
2
- * v 0.1.1 Has docker image. Handle up to 99
3
- * v 0.1.0 Handles numbers 1-19
1
+ * 0.1.7 - Fixed whitu and waru number mix up
2
+ * 0.1.6 - Allow input of macrons
3
+ - Fixed math test
4
+ - Use Ruby 2.7 in docker
5
+ * 0.1.5 - Added simple addition math test
6
+ * 0.1.4 - Pronounce integers on inspection for better terminal experience
7
+ - Handle up to 999 and accent marks
8
+ * 0.1.3 Bug fix. 'Whakahua' did not handle 'iwa' and numbers like toru tekau
9
+ * 0.1.2 whakahua method to pronounce numbers
10
+ * 0.1.1 Has docker image. Handle up to 99
11
+ * 0.1.0 Handles numbers 1-19
data/Dockerfile CHANGED
@@ -1,10 +1,10 @@
1
- FROM ruby:2.6
2
- MAINTAINER Samuel Garratt
3
-
4
- RUN mkdir /app
5
- WORKDIR /app
6
- COPY . /app
7
- RUN gem install bundler
8
- RUN bundle install
9
-
10
- ENTRYPOINT ["ruby", "exe/te_reo_maori"]
1
+ FROM ruby:3-alpine
2
+ LABEL AUTHOR="Samuel Garratt"
3
+
4
+ RUN mkdir /app
5
+ WORKDIR /app
6
+ COPY . /app
7
+ RUN gem install bundler
8
+ RUN bundle install --without development
9
+
10
+ ENTRYPOINT ["ruby", "exe/te_reo_maori"]
data/Gemfile CHANGED
@@ -1,9 +1,11 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in te_reo_maori.gemspec
6
- gemspec
7
-
8
- gem 'rake', '~> 12.0'
9
- gem 'rspec', '~> 3.0'
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in te_reo_maori.gemspec
6
+ gemspec
7
+
8
+ group :development do
9
+ gem 'rake', '~> 12.0'
10
+ gem 'rspec', '~> 3.0'
11
+ end
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 TODO: Write your name
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,59 +1,61 @@
1
- # TeReoMaori
2
-
3
- Tool to aid one to learn Maori and enable one to program in Maori.
4
-
5
- ## Installation
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
-
13
- Add this line to your application's Gemfile:
14
-
15
- ```ruby
16
- gem 'te_reo_maori'
17
- ```
18
-
19
- And then execute:
20
-
21
- $ bundle install
22
-
23
- Or install it yourself as:
24
-
25
- $ gem install te_reo_maori
26
-
27
- ## Usage
28
-
29
- Count in maori
30
-
31
- ```ruby
32
- tahi + rua
33
- # Will give a result of 3
34
- 3.whakahua
35
- # Will return 'toru'
36
- whakahua(tahi + tahi)
37
- # Will return 'rua'
38
- ```
39
-
40
- Execute in interactive terminal. After installing type `te_reo_maori` on command prompt to open it.
41
-
42
- ## Development
43
-
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.
45
-
46
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47
-
48
- ## Contributing
49
-
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).
51
-
52
-
53
- ## License
54
-
55
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
56
-
57
- ## Code of Conduct
58
-
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).
1
+ # TeReoMaori
2
+
3
+ Tool to aid one to learn Maori and enable one to program in Maori.
4
+
5
+ Learn Maori at https://maoridictionary.co.nz/
6
+
7
+ ## Installation
8
+
9
+ Execute interactive terminal in docker
10
+
11
+ `docker run --rm -it registry.gitlab.com/samuel-garratt/te_reo_maori`
12
+
13
+ ### As a ruby gem
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'te_reo_maori'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle install
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install te_reo_maori
28
+
29
+ ## Usage
30
+
31
+ Count in maori
32
+
33
+ ```ruby
34
+ tahi + rua
35
+ # Will give a result of 3
36
+ 3.whakahua
37
+ # Will return 'toru'
38
+ whakahua(tahi + tahi)
39
+ # Will return 'rua'
40
+ ```
41
+
42
+ Execute in interactive terminal. After installing type `te_reo_maori` on command prompt to open it.
43
+
44
+ ## Development
45
+
46
+ 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.
47
+
48
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+
50
+ ## Contributing
51
+
52
+ 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).
53
+
54
+
55
+ ## License
56
+
57
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
58
+
59
+ ## Code of Conduct
60
+
61
+ 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/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,15 +1,15 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'te_reo_maori'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'te_reo_maori'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/te_reo_maori CHANGED
@@ -1,25 +1,28 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'irb'
5
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
6
- require 'te_reo_maori'
7
-
8
- def putanga
9
- exit
10
- end
11
-
12
- extend Tau # Make numbers available
13
-
14
- puts 'Nau mai haere mai. Welcome to this application for learning and interacting with Maori.'
15
- puts 'Type "putanga" to exit'
16
- puts 'Try and perform +, -, * (times), / (divide) with Maori'
17
- puts 'The numbers are: '
18
- Tau.rarangi.each do |tau, whakamaoritanga|
19
- puts "#{tau}: #{whakamaoritanga}"
20
- end
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'
24
-
25
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'irb'
5
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
6
+ require 'te_reo_maori'
7
+
8
+ def putanga
9
+ exit
10
+ end
11
+
12
+ extend Tau # Make numbers available
13
+ extend WhakamatautauPangarau
14
+
15
+ puts 'Nau mai haere mai. Welcome to this application for learning and interacting with Maori.'
16
+ puts 'Type "putanga" to exit'
17
+ puts 'Type "pangarau" for maths test'
18
+ puts 'Try and perform +, -, * (times), / (divide) with Maori'
19
+ puts 'The numbers are: '
20
+ Tau.rarangi.each do |tau, whakamaoritanga|
21
+ puts "#{tau}: #{whakamaoritanga}"
22
+ end
23
+ puts 'If you type a number and press you will see Maori equivalent. Numbers > 10 must be wrapped in (). Greatest supported is 999'
24
+ puts 'Example of bigger numbers. 12: "tekau ma rua". Add 23 + 33: "(rua tekau ma toru) + (toru tekau ma toru)"'
25
+ puts 'See integer form by calling "tau", e.g., "((rua tekau ma toru) + (toru tekau ma toru)).tau" '
26
+ puts 'If you have any ideas on how this can be improved add issue to https://gitlab.com/samuel-garratt/te_reo_maori/-/issues'
27
+
28
+ IRB.start(__FILE__)
data/lib/te_reo_maori.rb CHANGED
@@ -1,9 +1,10 @@
1
- # frozen_string_literal: true
2
-
3
- require 'te_reo_maori/version'
4
- require 'te_reo_maori/tau'
5
-
6
- module TeReoMaori
7
- class Error < StandardError; end
8
- # Your code goes here...
9
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'te_reo_maori/version'
4
+ require 'te_reo_maori/tau'
5
+ require 'te_reo_maori/whakamatautau_pangarau'
6
+
7
+ module TeReoMaori
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
@@ -1,78 +1,83 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'whakahua'
4
-
5
- # Number in Maori
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
-
13
- # List numbers
14
- def self.rarangi
15
- {
16
- 1 => 'tahi', 2 => 'rua', 3 => 'toru', 4 => 'wha', 5 => 'rima', 6 => 'ono', 7 => 'waru',
17
- 8 => 'iwa', 10 => 'tekau'
18
- }
19
- end
20
-
21
- def digit(tau, second_digit)
22
- return tau if second_digit.nil?
23
-
24
- ((tau - 1) * 10) + second_digit
25
- end
26
-
27
- # 1
28
- def tahi
29
- 1
30
- end
31
-
32
- # 2
33
- def rua(second_digit = nil)
34
- digit(2, second_digit)
35
- end
36
-
37
- # 3
38
- def toru(second_digit = nil)
39
- digit(3, second_digit)
40
- end
41
-
42
- # 4
43
- def wha(second_digit = nil)
44
- digit(4, second_digit)
45
- end
46
-
47
- # 5
48
- def rima(second_digit = nil)
49
- digit(5, second_digit)
50
- end
51
-
52
- # 6
53
- def ono(second_digit = nil)
54
- digit(6, second_digit)
55
- end
56
-
57
- def whitu(second_digit = nil)
58
- digit(7, second_digit)
59
- end
60
-
61
- def waru(second_digit = nil)
62
- digit(8, second_digit)
63
- end
64
-
65
- def iwa(second_digit = nil)
66
- digit(9, second_digit)
67
- end
68
-
69
- # 10. Used to add groups of 10
70
- def tekau(extra_digit = nil)
71
- extra_digit ? 10 + extra_digit : 10
72
- end
73
-
74
- # Add extra digit
75
- def ma(extra_digit)
76
- extra_digit
77
- end
78
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'whakahua'
4
+
5
+ # Number in Maori
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
+
13
+ # List numbers
14
+ def self.rarangi
15
+ {
16
+ 1 => 'tahi', 2 => 'rua', 3 => 'toru', 4 => 'whā', 5 => 'rima', 6 => 'ono', 7 => 'whitu',
17
+ 8 => 'waru', 9 => 'iwa', 10 => 'tekau'
18
+ }
19
+ end
20
+
21
+ # Handles multiple digits
22
+ def digit(tau, second_digit)
23
+ return tau if second_digit.nil?
24
+
25
+ ((tau - 1) * 10) + second_digit
26
+ end
27
+
28
+ # 1
29
+ def tahi
30
+ 1
31
+ end
32
+
33
+ # 2
34
+ def rua(second_digit = nil)
35
+ digit(2, second_digit)
36
+ end
37
+
38
+ # 3
39
+ def toru(second_digit = nil)
40
+ digit(3, second_digit)
41
+ end
42
+
43
+ # 4
44
+ def wha(second_digit = nil)
45
+ digit(4, second_digit)
46
+ end
47
+
48
+ alias whā wha
49
+
50
+ # 5
51
+ def rima(second_digit = nil)
52
+ digit(5, second_digit)
53
+ end
54
+
55
+ # 6
56
+ def ono(second_digit = nil)
57
+ digit(6, second_digit)
58
+ end
59
+
60
+ def whitu(second_digit = nil)
61
+ digit(7, second_digit)
62
+ end
63
+
64
+ def waru(second_digit = nil)
65
+ digit(8, second_digit)
66
+ end
67
+
68
+ def iwa(second_digit = nil)
69
+ digit(9, second_digit)
70
+ end
71
+
72
+ # 10. Used to add groups of 10
73
+ def tekau(extra_digit = nil)
74
+ extra_digit ? 10 + extra_digit : 10
75
+ end
76
+
77
+ # Add extra digit
78
+ def ma(extra_digit)
79
+ extra_digit
80
+ end
81
+
82
+ alias mā ma
83
+ end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- module TeReoMaori
4
- VERSION = '0.1.2'
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ module TeReoMaori
4
+ VERSION = '0.1.7'
5
+ end
@@ -1,22 +1,51 @@
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
1
+ # frozen_string_literal: true
2
+
3
+ # Extension to Integer for Maori
4
+ class Integer
5
+ def inspect
6
+ whakahua
7
+ end
8
+
9
+ # Numeric form of integer
10
+ def tau
11
+ to_s
12
+ end
13
+
14
+ # @param [Integer] upper_part Integer of number of 100s
15
+ # @param [String] lower_part Already translated part less than 100
16
+ def add_parts(upper_part, lower_part)
17
+ if upper_part == 0
18
+ lower_part
19
+ elsif upper_part == 1
20
+ "kotahi rau #{lower_part}"
21
+ else
22
+ "#{upper_part.whakahua} rau #{lower_part}"
23
+ end
24
+ end
25
+
26
+ # Pronounce number
27
+ def whakahua
28
+ raise NotImplementedError, "Amount of #{self} implemented yet" if self > 999 || self < 1
29
+ return 'kotahi rau' if self == 100
30
+
31
+ lower_part = self % 100
32
+ upper_part = self / 100
33
+
34
+ last_digit = lower_part % 10
35
+ last_digit_word = Tau.rarangi[last_digit]
36
+
37
+ first_digit = (lower_part / 10)
38
+ if first_digit.positive?
39
+ if last_digit.zero?
40
+ return add_parts(upper_part, 'tekau') if first_digit == 1
41
+
42
+ return add_parts upper_part, "#{Tau.rarangi[first_digit]} tekau"
43
+ end
44
+
45
+ return add_parts upper_part, "tekau mā #{last_digit_word}" if first_digit == 1
46
+
47
+ return add_parts upper_part, "#{Tau.rarangi[first_digit]} tekau mā #{last_digit_word}"
48
+ end
49
+ add_parts upper_part, last_digit_word
50
+ end
51
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Math test
4
+ module WhakamatautauPangarau
5
+ # Mathematics. Start a maths test
6
+ def pangarau
7
+ puts 'Nau mai. Please type the answer in Teo Reo Maori (e.g "tahi" for 1) when prompted'
8
+ tau1 = rand(100).to_i
9
+ tau2 = rand(100).to_i
10
+ whakautu_tika = tau1 + tau2
11
+ puts "#{tau1.inspect} + #{tau2.inspect}?"
12
+ whakautu = eval(gets).to_i
13
+ if whakautu == whakautu_tika
14
+ puts 'Ka pai. Correct!'
15
+ else
16
+ puts "Incorrect. You put '#{whakautu.inspect} (#{whakautu})'.
17
+ Correct answer is '#{whakautu_tika.inspect} (#{whakautu_tika})'"
18
+ end
19
+ end
20
+ end
data/te_reo_maori.gemspec CHANGED
@@ -1,29 +1,29 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/te_reo_maori/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'te_reo_maori'
7
- spec.version = TeReoMaori::VERSION
8
- spec.authors = ['Samuel Garratt']
9
- spec.email = ['samuel.garratt@integrationqa.com']
10
-
11
- spec.summary = 'Tool to aid one to learn Maori and enable one to program in Maori.'
12
- spec.description = 'Tool to aid one to learn Maori and enable one to program in Maori.'
13
- spec.homepage = 'https://gitlab.com/samuel-garratt/te_reo_maori'
14
- spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
16
-
17
- spec.metadata['homepage_uri'] = spec.homepage
18
- spec.metadata['source_code_uri'] = 'https://gitlab.com/samuel-garratt/te_reo_maori'
19
- spec.metadata['changelog_uri'] = 'https://gitlab.com/samuel-garratt/te_reo_maori/ChangeLog'
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
- end
26
- spec.bindir = 'exe'
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ['lib']
29
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/te_reo_maori/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'te_reo_maori'
7
+ spec.version = TeReoMaori::VERSION
8
+ spec.authors = ['Samuel Garratt']
9
+ spec.email = ['samuel.garratt@integrationqa.com']
10
+
11
+ spec.summary = 'Tool to aid one to learn Maori and enable one to program in Maori.'
12
+ spec.description = 'Tool to aid one to learn Maori and enable one to program in Maori.'
13
+ spec.homepage = 'https://gitlab.com/samuel-garratt/te_reo_maori'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://gitlab.com/samuel-garratt/te_reo_maori'
19
+ spec.metadata['changelog_uri'] = 'https://gitlab.com/samuel-garratt/te_reo_maori/ChangeLog'
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+ 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.2
4
+ version: 0.1.7
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-18 00:00:00.000000000 Z
11
+ date: 2021-05-01 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:
@@ -35,6 +35,7 @@ files:
35
35
  - lib/te_reo_maori/tau.rb
36
36
  - lib/te_reo_maori/version.rb
37
37
  - lib/te_reo_maori/whakahua.rb
38
+ - lib/te_reo_maori/whakamatautau_pangarau.rb
38
39
  - te_reo_maori.gemspec
39
40
  homepage: https://gitlab.com/samuel-garratt/te_reo_maori
40
41
  licenses:
@@ -58,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  - !ruby/object:Gem::Version
59
60
  version: '0'
60
61
  requirements: []
61
- rubygems_version: 3.0.6
62
+ rubygems_version: 3.0.3
62
63
  signing_key:
63
64
  specification_version: 4
64
65
  summary: Tool to aid one to learn Maori and enable one to program in Maori.