kabal 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/kabal/config/yaml_loader.rb +10 -6
- data/lib/kabal/languages/language.rb +3 -3
- data/lib/kabal/languages/russian/natural_numbers.rb +0 -1
- data/lib/kabal/languages/russian.rb +5 -1
- data/lib/kabal/version.rb +1 -1
- data/lib/kabal.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6647a2fac0b691b81ec19fab675b22a3e510c985
|
4
|
+
data.tar.gz: f499270af4bbd4889befe207c0c2435a272e5e6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c88d230ebefce822c8b0ef3c5a6d8664774619a8b39b2df0299ab16ddebd338893cb298d843f2568a29f8954878b4bd139a809d088c9ad598dbfcf51eda72dcf
|
7
|
+
data.tar.gz: 435818137995cb3c766e514491d45362edfa4a99c5ae50b45cdbfab1098d8e9127738f02d7ae45622fca5d7bf4b81d42c3cb93a00d0498e7b45a905ebbbf321b
|
data/README.md
CHANGED
@@ -85,7 +85,16 @@ To add Elfin language you should:
|
|
85
85
|
minus: #Minus on Elfin Language#
|
86
86
|
```
|
87
87
|
4. Add `Elfin: "el"` to `yaml/languages.yml`.
|
88
|
-
5. Add
|
88
|
+
5. Add to `yaml/support.yml`
|
89
|
+
|
90
|
+
```yaml
|
91
|
+
el:
|
92
|
+
natural:
|
93
|
+
min: {min_of_your_realization}
|
94
|
+
max: {max_of_your_realization}
|
95
|
+
fractional:
|
96
|
+
symbols: {count_of_symbols_after_dot_that_you_realized}
|
97
|
+
```
|
89
98
|
6. Add `require "kabal/languages/elfin"` to `lib/kabal/supported_languages.rb`.
|
90
99
|
|
91
100
|
## Testing
|
@@ -1,9 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Kabal
|
2
|
+
module Config
|
3
|
+
class YamlLoader
|
4
|
+
def self.gem_root
|
5
|
+
Gem::Specification.find_by_name("kabal").gem_dir
|
6
|
+
end
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
def self.yaml_object(filename)
|
9
|
+
yaml_obj = YAML.load_file(gem_root + "/yaml/" + filename + ".yml")
|
10
|
+
end
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Kabal
|
2
2
|
class Language
|
3
3
|
def initialize
|
4
|
-
@names = YamlLoader.yaml_object "languages/#{lang}"
|
5
|
-
@supports = YamlLoader.yaml_object("support")["support"][lang]
|
4
|
+
@names = Kabal::Config::YamlLoader.yaml_object "languages/#{lang}"
|
5
|
+
@supports = Kabal::Config::YamlLoader.yaml_object("support")["support"][lang]
|
6
6
|
end
|
7
7
|
|
8
8
|
def convert(number)
|
@@ -11,7 +11,7 @@ module Kabal
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def lang
|
14
|
-
languages = YamlLoader.yaml_object "languages"
|
14
|
+
languages = Kabal::Config::YamlLoader.yaml_object "languages"
|
15
15
|
@lang = languages[self.to_s.split(":")[-2]]
|
16
16
|
end
|
17
17
|
|
@@ -10,7 +10,11 @@ class Kabal::Russian < Kabal::Language
|
|
10
10
|
def convert_number(number)
|
11
11
|
#FIXME find better way
|
12
12
|
@number_name = nil
|
13
|
-
need_minus?
|
13
|
+
if need_minus? number
|
14
|
+
minus + " " + number_words(-number)
|
15
|
+
else
|
16
|
+
number_words number
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
def number_words(number)
|
data/lib/kabal/version.rb
CHANGED
data/lib/kabal.rb
CHANGED
@@ -15,7 +15,7 @@ module Kabal
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def language=(language_to_set)
|
18
|
-
languages = YamlLoader.yaml_object "languages"
|
18
|
+
languages = Kabal::Config::YamlLoader.yaml_object "languages"
|
19
19
|
if languages[language_to_set]
|
20
20
|
@language = language_to_set
|
21
21
|
else
|
@@ -24,7 +24,7 @@ module Kabal
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def to_text_in_language(number, language_at_once)
|
27
|
-
languages = YamlLoader.yaml_object "languages"
|
27
|
+
languages = Kabal::Config::YamlLoader.yaml_object "languages"
|
28
28
|
if languages[language_at_once]
|
29
29
|
obj = Object.const_get("Kabal::" + language_at_once).new
|
30
30
|
obj.convert number
|
@@ -39,7 +39,7 @@ module Kabal
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def supported_languages
|
42
|
-
languages = YamlLoader.yaml_object "languages"
|
42
|
+
languages = Kabal::Config::YamlLoader.yaml_object "languages"
|
43
43
|
languages.keys
|
44
44
|
end
|
45
45
|
|
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.4
|
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-
|
11
|
+
date: 2014-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,3 +109,4 @@ test_files:
|
|
109
109
|
- test/lib/kabal/languages/russian_test.rb
|
110
110
|
- test/lib/kabal_test.rb
|
111
111
|
- test/test_helper.rb
|
112
|
+
has_rdoc:
|