kabal 1.0.1 → 1.0.2

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: c320388dd7d3d224706c90a97fcace03b2c86131
4
- data.tar.gz: 90f36dc3e091c41cc0d119f83a35b4b41aba328d
3
+ metadata.gz: 1ea013a0f028d6323f4ab271f5647adf7f1742ea
4
+ data.tar.gz: 432fa5274031043a02af026dadc029724a162afd
5
5
  SHA512:
6
- metadata.gz: e4c81f9fb94f5ceb2c481ccd3df54d875c2f9002922503999878cafea214e6ffa18f926ffad1a0d180d4e555d266b6d7304b51b7340d8e77ce6961653dafe279
7
- data.tar.gz: ebbb2434ceb4606f2419fee3483de0bf8a0b21b7d2501c795d79d042b305ae03cee211e2946bda5c37eddb6dd78bb91ac867c05168a980ff788959c077f545fd
6
+ metadata.gz: 8ff3291a1af1796313e96bc1d91bbfcf9fd859457e2d5c6a0c932584c4558dd978e0426e05b067c958b2feb801e7a3ce5739a7bd3672e7dc3991ec8bfd1ecf26
7
+ data.tar.gz: 56d0dbe59f9e225dac8cbe40253d614dab5f871f72a442484042ed6efb73ec0d99c7bb6eaf58bc1c8a5cb4d4ae451a6f57efbeb87f6134a9c79ca44e3d640d46
@@ -0,0 +1,21 @@
1
+ module Kabal
2
+ module GlobalRules
3
+ module NumberProperities
4
+ def fractional?(number)
5
+ number % 1 != 0
6
+ end
7
+ def natural?(number)
8
+ number % 1 == 0
9
+ end
10
+ def number_is_thousands?(number)
11
+ number_order(number) < 3
12
+ end
13
+ def number_is_google?(number)
14
+ count(number) == 10 && number_order(number) == 99
15
+ end
16
+ def need_minus?(number)
17
+ number < 0
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,10 +1,12 @@
1
1
  require 'kabal/languages/global/fractional_numbers'
2
2
  require 'kabal/languages/global/natural_numbers'
3
+ require 'kabal/languages/global/number_properities'
3
4
 
4
5
  module Kabal
5
6
  class Language
6
7
  include Kabal::GlobalRules::NaturalNumbers
7
8
  include Kabal::GlobalRules::FractionalNumbers
9
+ include Kabal::GlobalRules::NumberProperities
8
10
 
9
11
  def initialize
10
12
  @names = Kabal::Config::YamlLoader.yaml_object "languages/#{lang}"
@@ -36,9 +38,8 @@ module Kabal
36
38
 
37
39
  def error(number)
38
40
  if number_is_out_of_the_range? number
39
- return Kabal::Errors::NumberOutRangeError.message
40
- end
41
- if (!supports_fractional?) && (number % 1 != 0)
41
+ Kabal::Errors::NumberOutRangeError.message
42
+ elsif (!supports_fractional?) && (number % 1 != 0)
42
43
  Kabal::Errors::NoSupportForFractionalNumberOnCurrentLanguages.message
43
44
  end
44
45
  end
@@ -80,22 +81,6 @@ module Kabal
80
81
  names[:dot]
81
82
  end
82
83
 
83
- def fractional?(number)
84
- number % 1 != 0
85
- end
86
-
87
- def natural?(number)
88
- number % 1 == 0
89
- end
90
-
91
- def number_is_thousands?(number)
92
- number_order(number) < 3
93
- end
94
-
95
- def number_is_google?(number)
96
- count(number) == 10 && number_order(number) == 99
97
- end
98
-
99
84
  def number_order(number)
100
85
  ((number.to_s.length - 1) / 3) * 3
101
86
  end
@@ -113,17 +98,13 @@ module Kabal
113
98
  end
114
99
 
115
100
  def fractional_but_no_support_fractional?(number)
116
- number % 1 != 0 && !supports_fractional?
101
+ fractional?(number) && !supports_fractional?
117
102
  end
118
103
 
119
104
  def no_supports?(number)
120
105
  fractional_but_no_support_fractional?(number) || number_is_out_of_the_range?(number)
121
106
  end
122
107
 
123
- def need_minus?(number)
124
- number < 0
125
- end
126
-
127
108
  def space
128
109
  ' '
129
110
  end
data/lib/kabal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kabal
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  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: 1.0.1
4
+ version: 1.0.2
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-08-16 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,6 +72,7 @@ files:
72
72
  - lib/kabal/languages/english/natural_numbers.rb
73
73
  - lib/kabal/languages/global/fractional_numbers.rb
74
74
  - lib/kabal/languages/global/natural_numbers.rb
75
+ - lib/kabal/languages/global/number_properities.rb
75
76
  - lib/kabal/languages/language.rb
76
77
  - lib/kabal/languages/russian.rb
77
78
  - lib/kabal/languages/russian/declinations.rb