rusprice 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98e728425d010198eaec9acec20704f0a3c8500ff9582448806a09f28c44dd2f
4
- data.tar.gz: 6bbf911b8d82d977a4fab6593a697a81ee2bf0a5cd9db8be08b4133c2b761d86
3
+ metadata.gz: 12ffeba9fbc42ea103fd24b30c0092d293d38d6bc1072cd8122f1f95aed4f940
4
+ data.tar.gz: 40e62c0e8ec90428676bce965f97e617ab502f0262057a706eec3fec5614e553
5
5
  SHA512:
6
- metadata.gz: ba47d4dad9e49b9e4e21843dd4ae10e50ab455cb4b6b762bf0f96356943cb62e2515464e5546f4a238f8a4f4d2b0f0318fb5e412e39cd33f0604a69373221326
7
- data.tar.gz: 3503a60068af1491fb21b912c91eb01b2b97a344f7405ddbb4e3b3e38d0daadc8eb1f77ba26f8d13056cf9962ad27b9558a3e85548f0a3dcbe55b112e1004fe9
6
+ metadata.gz: 50230d152a4744bc8effc33ec9ccf897e3a4e5a6bde6bf7d762d8bb3f829517956b6b5c607e0c683391a28587bfd218caac84e91de37c92d997030e69bd857e2
7
+ data.tar.gz: 4619904a27f05daac2c1a3eb7fcc802842e6bccb3f8d8bdc3564e7cca1c70b27a4f0423dac97e72db23869e5b494832f245629dea94fc802c6bc68ea2de53450
data/README.md CHANGED
@@ -44,7 +44,7 @@ gem 'rusprice'
44
44
  # "72 копейки"
45
45
  ```
46
46
 
47
- ## Вспомотательные методы
47
+ ## Вспомогательные методы
48
48
 
49
49
  Начиная с [версии 1.0.0](https://github.com/klekot/rusprice/tree/v1.0.0) метод "rusprice" имеет два необязательных параметра:
50
50
  - Разделитель разрядов числа, например:
@@ -27,40 +27,35 @@ module RusPrice
27
27
 
28
28
  # Just shortcut for method "rusprice"
29
29
  def rp (sep = '', short = false)
30
- self.rusprice sep, short
30
+ rusprice sep, short
31
31
  end
32
32
 
33
33
  # "rusprice" with whitespaces by default
34
34
  def ruspace (short = false)
35
- self.rusprice ' ', short
35
+ rusprice ' ', short
36
36
  end
37
37
 
38
38
  # "rusprice" with "руб." and "коп." by default
39
39
  def rushort (sep = ' ')
40
- self.rusprice sep, true
40
+ rusprice sep, true
41
41
  end
42
42
 
43
43
  # "rusprice" with whitespaces and "руб." and "коп." by default
44
44
  def rpss
45
- self.rusprice ' ', true
45
+ rusprice ' ', true
46
46
  end
47
47
 
48
48
  private
49
49
 
50
- def cases number, kind
51
- if kind == 'рубль' || 'копейка'
52
- case
53
- when [11, 12, 13, 14].include?(number % 100)
54
- kind == 'рубль' ? 'рублей' : 'копеек'
55
- when number % 10 == 1
56
- kind == 'рубль' ? 'рубль' : 'копейка'
57
- when [2, 3, 4].include?(number % 10)
58
- kind == 'рубль' ? 'рубля' : 'копейки'
59
- else
60
- kind == 'рубль' ? 'рублей' : 'копеек'
61
- end
50
+ def cases (number, kind)
51
+ if [11, 12, 13, 14].include?(number % 100)
52
+ kind == 'рубль' ? 'рублей' : 'копеек'
53
+ elsif number % 10 == 1
54
+ kind == 'рубль' ? 'рубль' : 'копейка'
55
+ elsif [2, 3, 4].include?(number % 10)
56
+ kind == 'рубль' ? 'рубля' : 'копейки'
62
57
  else
63
- ''
58
+ kind == 'рубль' ? 'рублей' : 'копеек'
64
59
  end
65
60
  end
66
61
 
@@ -1,3 +1,3 @@
1
1
  module RusPrice
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rusprice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Klekotnev