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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23924e082596e41018e847bfd9096c4d7e99fa0d
4
- data.tar.gz: 284457d7491749ef5f4b7d0fbc6fdf57fe1deba7
3
+ metadata.gz: 6647a2fac0b691b81ec19fab675b22a3e510c985
4
+ data.tar.gz: f499270af4bbd4889befe207c0c2435a272e5e6d
5
5
  SHA512:
6
- metadata.gz: f33f54547f1815dc2b504202a7f02b9894918033dbba63b1651ae38fb690c757fef6c7a2cfc873b69d7847a216f1f03c113376b6f6f5f98803d3a1010f491c2c
7
- data.tar.gz: 8eedf49941bae9d8001a9e94d67f155602e66730226f1c2f561c99ede8d44798391da142e4faf0545beef9d4a4d3abe9a3222dcea18f06e2c4eb3becd9758fdc
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 `el: natural: min: {min_of_your_realization}" max: {max_of_your_realization} fractional: symbols: {count_of_symbols_after_dot_that_you_realized}` to `yaml/support.yml`
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
- class Kabal::Config::YamlLoader
2
- def self.gem_root
3
- Gem::Specification.find_by_name("kabal").gem_dir
4
- end
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
- def self.yaml_object(filename)
7
- yaml_obj = YAML.load_file(gem_root + "/yaml/" + filename + ".yml")
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
 
@@ -1,7 +1,6 @@
1
1
  module Kabal
2
2
  module RussianRules
3
3
  module NaturalNumbers
4
-
5
4
  def feminine_natural_number_name(number, fractional_part = false)
6
5
  @number = number
7
6
  @feminine_name = !fractional_part
@@ -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?(number) ? (minus + " " + number_words(-number)) : number_words(number)
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
@@ -1,3 +1,3 @@
1
1
  module Kabal
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
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.3
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-05-14 00:00:00.000000000 Z
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: