ru_propisju 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -1
- data/History.txt +4 -0
- data/lib/ru_propisju.rb +5 -6
- data/ru_propisju.gemspec +11 -7
- data/test/test_ru_propisju.rb +4 -0
- metadata +24 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dc29699dc852feead63990d7aac25f924e0c770
|
4
|
+
data.tar.gz: 7b48a7806d522d0464f901cce53c7b6bfcc6a483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7174d7a50f43ceacfa80481fb27472e0aac36653d5bf5f205693861df17a11d2be01a108c662eafd8f04146eae0c3d1d1eee6c776666e93ba1afd266f7755ca2
|
7
|
+
data.tar.gz: af5f85e2de1222014234ca9df3a0c0058eed691ab13b52bcb812619999539a702a7e5550f9509662c7756bab7e9fe5d8bb63842ac64c47331732c377c8bdf2c2
|
data/Gemfile
CHANGED
data/History.txt
CHANGED
data/lib/ru_propisju.rb
CHANGED
@@ -6,7 +6,7 @@ $KCODE = 'u' if RUBY_VERSION < '1.9.0'
|
|
6
6
|
# RuPropisju.rublej(123) # "сто двадцать три рубля"
|
7
7
|
module RuPropisju
|
8
8
|
|
9
|
-
VERSION = '2.2.
|
9
|
+
VERSION = '2.2.3'
|
10
10
|
|
11
11
|
# http://www.xe.com/symbols.php
|
12
12
|
# (лица, приближенные форексам и всяким там валютам и курсам)
|
@@ -215,7 +215,7 @@ module RuPropisju
|
|
215
215
|
end
|
216
216
|
# Выбирает корректный вариант числительного в зависимости от рода и числа и оформляет сумму прописью
|
217
217
|
#
|
218
|
-
# propisju(243) => "двести сорок три"
|
218
|
+
# propisju(243, 1) => "двести сорок три"
|
219
219
|
# propisju(221, 2) => "двести двадцать одна"
|
220
220
|
def propisju(amount, gender, locale = :ru)
|
221
221
|
if amount.is_a?(Integer) || amount.is_a?(Bignum)
|
@@ -417,8 +417,7 @@ module RuPropisju
|
|
417
417
|
}
|
418
418
|
|
419
419
|
# Выдает сумму прописью с учетом дробной доли. Дробная доля округляется до миллионной, или (если
|
420
|
-
# дробная доля оканчивается на нули) до ближайшей доли ( 500 тысячных округляется до 5
|
421
|
-
# Дополнительный аргумент - род существительного (1 - мужской, 2- женский, 3-средний)
|
420
|
+
# дробная доля оканчивается на нули) до ближайшей доли или точки ( 500 тысячных округляется до 5 десятых, 30.0000 до 30).
|
422
421
|
def propisju_float(num, locale = :ru)
|
423
422
|
locale_root = pick_locale(DECIMALS, locale)
|
424
423
|
source_expression = locale_root[:prefix][0]
|
@@ -432,8 +431,8 @@ module RuPropisju
|
|
432
431
|
end.freeze
|
433
432
|
|
434
433
|
# Укорачиваем до триллионной доли
|
435
|
-
formatted = (
|
436
|
-
wholes, decimals = formatted.split(
|
434
|
+
formatted = num.to_s[/^\d+(\.\d{0,#{words.length}})?/].gsub(/0+$/, '')
|
435
|
+
wholes, decimals = formatted.split(".")
|
437
436
|
|
438
437
|
return propisju_int(wholes.to_i, 1, [], locale) if decimals.to_i.zero?
|
439
438
|
|
data/ru_propisju.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: ru_propisju 2.2.3 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "ru_propisju"
|
8
|
-
s.version = "2.2.
|
9
|
+
s.version = "2.2.3"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Julik Tarkhanov"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2014-04-15"
|
13
15
|
s.email = "me@julik.nl"
|
14
16
|
s.extra_rdoc_files = [
|
15
17
|
"README.rdoc"
|
@@ -25,23 +27,25 @@ Gem::Specification.new do |s|
|
|
25
27
|
]
|
26
28
|
s.homepage = "http://github.com/julik/ru_propisju"
|
27
29
|
s.licenses = ["MIT"]
|
28
|
-
s.
|
29
|
-
s.rubygems_version = "2.0.3"
|
30
|
+
s.rubygems_version = "2.2.2"
|
30
31
|
s.summary = "C\u{443}\u{43c}\u{43c}\u{430} \u{43f}\u{440}\u{43e}\u{43f}\u{438}\u{441}\u{44c}\u{44e}"
|
31
32
|
|
32
33
|
if s.respond_to? :specification_version then
|
33
34
|
s.specification_version = 4
|
34
35
|
|
35
36
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
36
|
-
s.add_development_dependency(%q<jeweler>, ["
|
37
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2"])
|
37
38
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
39
|
+
s.add_development_dependency(%q<test-unit>, [">= 0"])
|
38
40
|
else
|
39
|
-
s.add_dependency(%q<jeweler>, ["
|
41
|
+
s.add_dependency(%q<jeweler>, ["~> 2"])
|
40
42
|
s.add_dependency(%q<rake>, [">= 0"])
|
43
|
+
s.add_dependency(%q<test-unit>, [">= 0"])
|
41
44
|
end
|
42
45
|
else
|
43
|
-
s.add_dependency(%q<jeweler>, ["
|
46
|
+
s.add_dependency(%q<jeweler>, ["~> 2"])
|
44
47
|
s.add_dependency(%q<rake>, [">= 0"])
|
48
|
+
s.add_dependency(%q<test-unit>, [">= 0"])
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
data/test/test_ru_propisju.rb
CHANGED
@@ -99,6 +99,10 @@ class TestRuPropisju < Test::Unit::TestCase
|
|
99
99
|
|
100
100
|
def test_propisju_for_floats
|
101
101
|
assert_equal "шесть целых пять десятых", RuPropisju.propisju(6.50, 1)
|
102
|
+
assert_equal "шесть", RuPropisju.propisju(6.0, 1)
|
103
|
+
assert_equal "тридцать миллиардов целых сто одиннадцать тысячных", RuPropisju.propisju(3 * 10**10 + 0.111, 1)
|
104
|
+
assert_equal "тридцать", RuPropisju.propisju(30.0, 1)
|
105
|
+
assert_equal "тридцать целых одна десятая", RuPropisju.propisju(30.1, 1)
|
102
106
|
assert_equal "триста сорок одна целая девять десятых", RuPropisju.propisju(341.9, 1)
|
103
107
|
assert_equal "триста сорок одна целая двести сорок пять тысячных", RuPropisju.propisju(341.245, 1)
|
104
108
|
assert_equal "двести три целых сорок одна сотая", RuPropisju.propisju(203.41, 1)
|
metadata
CHANGED
@@ -1,41 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ru_propisju
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
33
|
version: '0'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- -
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: test-unit
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
description:
|
@@ -62,17 +76,17 @@ require_paths:
|
|
62
76
|
- lib
|
63
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
|
-
- -
|
79
|
+
- - ">="
|
66
80
|
- !ruby/object:Gem::Version
|
67
81
|
version: '0'
|
68
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
83
|
requirements:
|
70
|
-
- -
|
84
|
+
- - ">="
|
71
85
|
- !ruby/object:Gem::Version
|
72
86
|
version: '0'
|
73
87
|
requirements: []
|
74
88
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.
|
89
|
+
rubygems_version: 2.2.2
|
76
90
|
signing_key:
|
77
91
|
specification_version: 4
|
78
92
|
summary: Cумма прописью
|