kabal 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tconsole +6 -0
- data/README.md +7 -2
- data/lib/kabal.rb +7 -2
- data/lib/kabal/version.rb +1 -1
- data/test/lib/bigtest.rb +14 -0
- data/test/lib/kabal_test.rb +8 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b54dc91c4b10e129d562e5c1c298655a7472d0e9
|
4
|
+
data.tar.gz: b223d38f34c12fd4dd854f87f5b2395088cc8678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1355837b14a476cb0ed7dc81c1cbdbe9618be241893e2a2c2f12d325492141b2ead43c8e1d2087adbc608bcc3df3f47054395d097672ad3cc0ec815faa45823a
|
7
|
+
data.tar.gz: 5f08687ce36d79c16217ea87632059e0468ce660695fb9da92d3b66a05f7d200733445c2ca382f32f0020165538f025ca7b083570d982018ac8bc6db03d78e47
|
data/.tconsole
ADDED
data/README.md
CHANGED
@@ -28,11 +28,11 @@ Kabal has one main feature - number to text "converting".
|
|
28
28
|
require 'kabal'
|
29
29
|
include Kabal
|
30
30
|
Kabal.to_text 1 #=> "один"
|
31
|
-
|
31
|
+
|
32
32
|
You can choose language to "converting".
|
33
33
|
|
34
34
|
Kabal.language = "Russian"
|
35
|
-
|
35
|
+
|
36
36
|
Supported Languages:
|
37
37
|
|
38
38
|
* Russian
|
@@ -56,3 +56,8 @@ To add Elfin language you should:
|
|
56
56
|
3. Create `yaml/languages/el.yml`. You'll add numbers and words, which they correspond, there.
|
57
57
|
4. Add `Elfin: "el"` to `yaml/languages.yml`.
|
58
58
|
5. Add `require "kabal/languages/elfin"` to `lib/kabal/supported_languages.rb`.
|
59
|
+
|
60
|
+
## Testing
|
61
|
+
|
62
|
+
Kabal has the BigTest. This test checks the correctness of the operation with all the numbers (0 to 10,000) in all supported languages.
|
63
|
+
Be careful: BigTest working with 10 001 numbers on one languages during around 3 minutes.
|
data/lib/kabal.rb
CHANGED
@@ -16,7 +16,7 @@ module Kabal
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def language=(language_to_set)
|
19
|
-
languages =
|
19
|
+
languages = YamlLoader.yaml_object "languages"
|
20
20
|
if languages[language_to_set]
|
21
21
|
@language = language_to_set
|
22
22
|
else
|
@@ -25,7 +25,7 @@ module Kabal
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def to_text_in_language(number, language_at_once)
|
28
|
-
languages =
|
28
|
+
languages = YamlLoader.yaml_object "languages"
|
29
29
|
if languages[language_at_once]
|
30
30
|
obj = Object.const_get("Kabal::" + language_at_once).new
|
31
31
|
obj.convert number
|
@@ -37,4 +37,9 @@ module Kabal
|
|
37
37
|
def current_language
|
38
38
|
@language
|
39
39
|
end
|
40
|
+
|
41
|
+
def supported_languages
|
42
|
+
languages = YamlLoader.yaml_object "languages"
|
43
|
+
languages.keys
|
44
|
+
end
|
40
45
|
end
|
data/lib/kabal/version.rb
CHANGED
data/test/lib/bigtest.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
include Kabal
|
4
|
+
|
5
|
+
class BigTest < TestCase
|
6
|
+
def test_all_numbers_for_all_languages
|
7
|
+
Kabal.supported_languages.each do |lang|
|
8
|
+
Kabal.language = lang
|
9
|
+
(0..10 ** 4).each do |number|
|
10
|
+
assert Kabal.to_text number
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/test/lib/kabal_test.rb
CHANGED
@@ -31,4 +31,12 @@ class KabalTest < TestCase
|
|
31
31
|
end
|
32
32
|
assert_equal NoLanguageSupportError.message, exception.message
|
33
33
|
end
|
34
|
+
|
35
|
+
def test_supported_languages
|
36
|
+
assert Kabal.supported_languages
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_current_language
|
40
|
+
assert Kabal.current_language
|
41
|
+
end
|
34
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kabal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- ".coveralls.yml"
|
49
49
|
- ".gitignore"
|
50
|
+
- ".tconsole"
|
50
51
|
- ".travis.yml"
|
51
52
|
- Gemfile
|
52
53
|
- LICENSE.txt
|
@@ -64,6 +65,7 @@ files:
|
|
64
65
|
- lib/kabal/languages/russian/declinations.rb
|
65
66
|
- lib/kabal/supported_languages.rb
|
66
67
|
- lib/kabal/version.rb
|
68
|
+
- test/lib/bigtest.rb
|
67
69
|
- test/lib/kabal/languages/russian_test.rb
|
68
70
|
- test/lib/kabal_test.rb
|
69
71
|
- test/test_helper.rb
|
@@ -94,6 +96,7 @@ signing_key:
|
|
94
96
|
specification_version: 4
|
95
97
|
summary: Number To Text Helper
|
96
98
|
test_files:
|
99
|
+
- test/lib/bigtest.rb
|
97
100
|
- test/lib/kabal/languages/russian_test.rb
|
98
101
|
- test/lib/kabal_test.rb
|
99
102
|
- test/test_helper.rb
|