geezify-rb 0.2.4 → 0.2.8
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/.travis.yml +1 -0
- data/LICENSE.txt +1 -1
- data/README.md +2 -1
- data/_config.yml +1 -0
- data/lib/geezify-rb/arabify.rb +11 -11
- data/lib/geezify-rb/geezify.rb +6 -6
- data/lib/geezify-rb/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19883a99a976ffc4bfac7d93d6245f7ab4be083d5f48bb5937dc5a2447b2f742
|
4
|
+
data.tar.gz: aa45c53cebbe0f30729800afb0328a40e6a4e2f83829c7cb86693838446178c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27c57dfcba7bc676815cf0b4b785a138ebf2079d0768cc9dd3e84ef063cf97589b7957eb5be8869d33b143f9637de9a4555ab9a933783cb7152d7e1a2827398d
|
7
|
+
data.tar.gz: aca210522fe0776a590d18461a1f2b6eddecd844910b3c6a1756594b035161886d78d89aafa903e2d753311bce78b886908006e439fa2256996e35d25a7d9147
|
data/.travis.yml
CHANGED
@@ -12,3 +12,4 @@ deploy:
|
|
12
12
|
secure: QcnETkp8zYWSvM8ihj7dV1kJZ51TjAeg/ZzCvZDYGGclFvnV1h1yf/+ePbNPexxiiELsD5SUsPLlso/5QzBVoVCs9VNMN7U9rCB9nc97SYq+qYAndE0WbF/ZuDJjn5rg4tr1ovpUZ4IZy0DD9NlzKNweBE8yYNlyXiDjaiWDgTs9/c1JTh2j91+gLMTee5BeQe8F4vXwNGq+EPtS14FCuq7/oYhbj4v5QcE76btd/LGTuNivHv+8RLuVNP4yKBb2qUrcbwFPl7/KyBjbnS6iLsCZORgDxCCi7OhVNE5kAEJQW+c8f+NfMx7/DfCc1RECR3j94IticsGsjJ4DVKn7M2ccBQo7CyaqB75Lzlq9PJG8lD2oHRVTVwKIyP9GIpmVhX6Lp/nMFybYvN3LkK50EATTd73KBWifoUTgKdAix5a5Ss9VjRNvhBeTTSA1lyhCDYAarUOYBqUTPxASgzvHWEpv27NKUz8MuK87vJtBsAaclqLc0/ViN89VfXgSk7Xp3z3iqnSzfoEFaDlW/VBQ0VI/nIkrPDKsrnqorB0FjLsorL7DhaZ+Ehjmou1kCUHAk5orpZ/AvlwBEGaxSyQvZ7uTz4p6K8xRyWKMFe5zA89KlMH/siqFkR5zzktL5qCyIDauqYpaBitwuZD2Zu533g2cqfSYcSJYFB4talr8hf8=
|
13
13
|
on:
|
14
14
|
tags: true
|
15
|
+
gem: geezify-rb
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2019
|
3
|
+
Copyright (c) 2019-2021 Yilkal Argaw (yilkalargawworkneh@gmail.com)
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Geezify-Rb
|
2
2
|
|
3
|
-
Geezify-rb is a gem that converts geez-script numbers to arabic and viceversa.
|
3
|
+
Geezify-rb is a gem that converts geez-script numbers to arabic and viceversa. You could read more about the number system at
|
4
|
+
[https://www.geez.org](https://www.geez.org/Numerals/)
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-cayman
|
data/lib/geezify-rb/arabify.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# coding: utf-8
|
3
|
-
|
3
|
+
# frozen_string_literal:true
|
4
4
|
|
5
5
|
module GeezifyRb
|
6
|
-
|
7
|
-
# This class contains the processing tools to convert Geeze numbers to arabic.
|
6
|
+
# processing tools to convert Geeze numbers to arabic.
|
8
7
|
class Arabify
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
ERROR_MSG_CONSTRUCTOR = 'invalid input the string is not a geez number'
|
9
|
+
ERROR_MSG1 = 'invalid input to method convert_2digit'
|
10
|
+
ERROR_MSG3 = 'invalid input to method rollback'
|
12
11
|
NUMHASH = Hash['፩' => 1, '፪' => 2, '፫' => 3, '፬' => 4,
|
13
12
|
'፭' => 5, '፮' => 6, '፯' => 7, '፰' => 8,
|
14
13
|
'፱' => 9, '፲' => 10, '፳' => 20, '፴' => 30,
|
@@ -31,7 +30,8 @@ module GeezifyRb
|
|
31
30
|
preprocessed
|
32
31
|
.each_with_index
|
33
32
|
.reduce(0) do |sum, (v, i)|
|
34
|
-
sum + convert_upto10000(v.strip) *
|
33
|
+
sum + convert_upto10000(v.strip) *
|
34
|
+
(10_000**(preprocessed.length - 1 - i))
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -65,14 +65,14 @@ module GeezifyRb
|
|
65
65
|
|
66
66
|
def validinput?(str)
|
67
67
|
str.split('')
|
68
|
-
|
69
|
-
|
68
|
+
.map { |x| NUMHASH.key?(x) || x == '፼' || x == '፻' }
|
69
|
+
.reduce(true) { |result, n| result && n }
|
70
70
|
end
|
71
71
|
|
72
72
|
def valid_for_2digit?(str)
|
73
73
|
str.length <= 2 && str.split('')
|
74
|
-
|
75
|
-
|
74
|
+
.map { |x| NUMHASH.key?(x) }
|
75
|
+
.reduce(true) { |res, n| res && n }
|
76
76
|
end
|
77
77
|
|
78
78
|
def valid_for_convupto10000?(str)
|
data/lib/geezify-rb/geezify.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# coding: utf-8
|
3
|
+
# frozen_string_literal:true
|
3
4
|
|
4
5
|
module GeezifyRb
|
5
|
-
|
6
6
|
# This class contains the processing tools to convert arabic numbers to Geeze.
|
7
7
|
class Geezify
|
8
|
-
ERROR_MSG_CONSTRUCTOR = 'invalid input the input is not a number'
|
9
|
-
ERROR_MSG1 = 'invalid input to method geezify_2digit'
|
10
|
-
ERROR_MSG2 = 'invalid input to geezify_4digit'
|
8
|
+
ERROR_MSG_CONSTRUCTOR = 'invalid input the input is not a number'
|
9
|
+
ERROR_MSG1 = 'invalid input to method geezify_2digit'
|
10
|
+
ERROR_MSG2 = 'invalid input to geezify_4digit'
|
11
11
|
|
12
|
-
# constructor
|
13
12
|
def initialize(num)
|
14
13
|
raise ArgumentError, ERROR_MSG_CONSTRUCTOR unless num.integer?
|
15
14
|
|
@@ -29,7 +28,8 @@ module GeezifyRb
|
|
29
28
|
def geezify_2digit(num)
|
30
29
|
oneth_array = Array['', '፩', '፪', '፫', '፬', '፭', '፮', '፯', '፰', '፱']
|
31
30
|
tenth_array = Array['', '፲', '፳', '፴', '፵', '፶', '፷', '፸', '፹', '፺']
|
32
|
-
raise ArgumentError, ERROR_MSG1 unless num.integer? &&
|
31
|
+
raise ArgumentError, ERROR_MSG1 unless num.integer? &&
|
32
|
+
num.between?(0, 99)
|
33
33
|
|
34
34
|
tenth_array[(num / 10)] + oneth_array[num % 10]
|
35
35
|
end
|
data/lib/geezify-rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geezify-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yilkal Argaw
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
|
+
- _config.yml
|
69
70
|
- bin/console
|
70
71
|
- bin/setup
|
71
72
|
- geezify-rb.gemspec
|
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
|
-
rubygems_version: 3.0.
|
96
|
+
rubygems_version: 3.0.8
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: This gem allows the user to change arabic numbers into geez script numbers
|