kabal 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kabal/version.rb +1 -1
- data/lib/kabal.rb +10 -0
- data/test/lib/kabal_test.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 813ac39940e2a2c9b6da8b38d3c76730ae3bfeb6
|
4
|
+
data.tar.gz: d623a344b9024a9794d3ad220daee550ff934028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4991b3ee930be2c5aee68abe6461bed9f43064f881468b390a2c7e53e131711ceff2ea8112576a9ad2117e0c15ce2af434b4dc5b0db69a70b976eb8cb8669691
|
7
|
+
data.tar.gz: 45e417159c0e91893f533f7d25ea1fb2d96a7be05487a4782fa9227cf5efc9b8c1e5b8c7951116f00362bcb56bfba4fb85e3acd076c71ecc7e01a064c73aa6a1
|
data/lib/kabal/version.rb
CHANGED
data/lib/kabal.rb
CHANGED
@@ -33,6 +33,16 @@ module Kabal
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def to_text_in_language_by_index(number, language_at_once_index)
|
37
|
+
languages = Kabal::Config::YamlLoader.yaml_object("languages").to_a
|
38
|
+
if languages[language_at_once_index]
|
39
|
+
obj = Object.const_get("Kabal::" + languages[language_at_once_index].first).new
|
40
|
+
obj.convert number
|
41
|
+
else
|
42
|
+
raise NoLanguageSupportError.message
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
36
46
|
def current_language
|
37
47
|
@language ||= "Russian"
|
38
48
|
@language
|
data/test/lib/kabal_test.rb
CHANGED
@@ -16,6 +16,10 @@ class KabalTest < TestCase
|
|
16
16
|
assert_equal Kabal.to_text_in_language(125125125125, "Russian"), "сто двадцать пять миллиардов сто двадцать пять миллионов сто двадцать пять тысяч сто двадцать пять"
|
17
17
|
end
|
18
18
|
|
19
|
+
def test_to_text_in_language_by_index
|
20
|
+
assert_equal Kabal.to_text_in_language_by_index(125125125125, 0), "сто двадцать пять миллиардов сто двадцать пять миллионов сто двадцать пять тысяч сто двадцать пять"
|
21
|
+
end
|
22
|
+
|
19
23
|
def test_to_text_in_language_with_unsupported_language
|
20
24
|
#FIXME replace RuntimeError to NoLanguageSupportError
|
21
25
|
exception = assert_raises RuntimeError do
|
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.2.
|
4
|
+
version: 0.2.9
|
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-06-
|
11
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|