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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49a2416f6d88f6923ab4bb4e4c66178fa58f11c1
4
- data.tar.gz: 77ac1afa36bbaabcc9bce5bfbe9571a5a055ff9f
3
+ metadata.gz: 813ac39940e2a2c9b6da8b38d3c76730ae3bfeb6
4
+ data.tar.gz: d623a344b9024a9794d3ad220daee550ff934028
5
5
  SHA512:
6
- metadata.gz: 451d0fb5e9601b3a39e99a16816fe3744887235f191b541564c6e9e0a7d678d42dc638932092b8142659c440ace2429b35906e7c10fc960a98a93508d2f1ab63
7
- data.tar.gz: da1d9b7ee4a08534f0013494900cc60ccbd6f77afe69dcbe832a4b4feb46805f5cde07b12ed524a742f5aee4d2cef2d9d55a7a4669661c5085540da2dc73acc8
6
+ metadata.gz: 4991b3ee930be2c5aee68abe6461bed9f43064f881468b390a2c7e53e131711ceff2ea8112576a9ad2117e0c15ce2af434b4dc5b0db69a70b976eb8cb8669691
7
+ data.tar.gz: 45e417159c0e91893f533f7d25ea1fb2d96a7be05487a4782fa9227cf5efc9b8c1e5b8c7951116f00362bcb56bfba4fb85e3acd076c71ecc7e01a064c73aa6a1
data/lib/kabal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kabal
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
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
@@ -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.8
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-21 00:00:00.000000000 Z
11
+ date: 2014-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler