slovom 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +46 -0
- data/Rakefile +7 -0
- data/lib/slovom.rb +151 -0
- data/lib/slovom/version.rb +3 -0
- data/slovom.gemspec +20 -0
- data/spec/slovom/slovom_spec.rb +0 -0
- data/spec/slovom_spec.rb +203 -0
- data/spec/spec_helper.rb +1 -0
- metadata +96 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Svilen Vassilev
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Slovom [![Build Status](https://secure.travis-ci.org/tarakanbg/slovom.png)](http://travis-ci.org/tarakanbg/slovom)
|
2
|
+
|
3
|
+
A Ruby gem which converts decimal currency numbers into text in Bulgarian language. For use in financial applications, accounting documents, and all other instances requiring currency verbalization.
|
4
|
+
|
5
|
+
Handles the specifics of verbally presenting numbers and prices in Bulgarian, including grammatical irregularities, differences due to gender, singularity and plurality and the logic of using or omitting the "and" conjunction from the resulting string.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'slovom'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install slovom
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Just append the `.slovom` method to the decimal (variable) you want to be presented verbally.
|
24
|
+
|
25
|
+
This will return a text string with the currency ammount (in levs) expressed verbally.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
product1.price.to_s => "23.00"
|
29
|
+
product1.price.slovom => "двадесет и три лева"
|
30
|
+
|
31
|
+
product2.price.to_s => "1563.78"
|
32
|
+
product2.price.slovom => "хиляда петстотин шестдесет и три лева и седемдесет и осем стотинки"
|
33
|
+
|
34
|
+
product3.price.to_s => "0.75"
|
35
|
+
product3.price.slovom => "седемдесет и пет стотинки"
|
36
|
+
```
|
37
|
+
|
38
|
+
It parses numbers of up to 1 quadrillion (1000000000000000), as higher numbers are not likely to be used in financial transactions and hence no need to be expressed verbally. It returns the string "много" if higher number is used.
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/slovom.rb
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require "slovom/version"
|
3
|
+
require 'bigdecimal'
|
4
|
+
|
5
|
+
class BigDecimal
|
6
|
+
def slovom
|
7
|
+
Slovom.slovom(self)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Slovom
|
12
|
+
def self.slovom(input)
|
13
|
+
input = input.round(2)
|
14
|
+
levs = input.fix.to_i
|
15
|
+
stotinki = input.frac.to_s('F').gsub("0.", '')
|
16
|
+
stotinki = (stotinki+"0")[0..1].to_i
|
17
|
+
output = ""
|
18
|
+
output += levs_slovom(levs) + levs_title(levs) unless levs_slovom(levs).nil? || levs_slovom(levs) == "много"
|
19
|
+
output += " и " unless levs_slovom(levs).nil? || levs_slovom(levs) == "много" || levs_slovom(stotinki, feminine=true).nil? || levs_slovom(stotinki, feminine=true) == "много"
|
20
|
+
output += levs_slovom(stotinki, feminine=true) + stotinki_title(stotinki) unless levs_slovom(stotinki, feminine=true).nil? || levs_slovom(stotinki, feminine=true) == "много"
|
21
|
+
return output
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def self.too_big
|
26
|
+
"много"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.levs_title(levs)
|
30
|
+
levs == 1 ? " лев" : " лева"
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.stotinki_title(stotinki)
|
34
|
+
stotinki == 1 ? " стотинка" : " стотинки"
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.levs_slovom(levs, feminine=nil)
|
38
|
+
case levs
|
39
|
+
when 1..99 then below_hundred(levs, feminine)
|
40
|
+
when 100..999 then hundreds(levs, feminine)
|
41
|
+
when 1000..999999 then thousands(levs, feminine)
|
42
|
+
when 1000000..999999999999999 then gazillions(levs, feminine)
|
43
|
+
else
|
44
|
+
too_big
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.below_hundred(digits, feminine=nil)
|
49
|
+
case digits
|
50
|
+
when 1..19 then basic_number(digits, feminine)
|
51
|
+
when 20..99 then round_ten(digits, feminine)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.basic_number(digits, feminine=nil)
|
56
|
+
case digits
|
57
|
+
when 1 then
|
58
|
+
feminine == true ? "една" : "един"
|
59
|
+
when 2 then
|
60
|
+
feminine == true ? "две" : "два"
|
61
|
+
when 3 then "три"
|
62
|
+
when 4 then "четири"
|
63
|
+
when 5 then "пет"
|
64
|
+
when 6 then "шест"
|
65
|
+
when 7 then "седем"
|
66
|
+
when 8 then "осем"
|
67
|
+
when 9 then "девет"
|
68
|
+
when 10 then "десет"
|
69
|
+
when 11 then "единадесет"
|
70
|
+
when 12 then "дванадесет"
|
71
|
+
when 13..19 then basic_number(digits.to_s[1].to_i)+"надесет"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.round_ten(digits, feminine=nil)
|
76
|
+
second_digit = digits.to_s.reverse.chr.to_i
|
77
|
+
output = basic_number(digits.to_s[0].to_i)+"десет"
|
78
|
+
output += " и " + basic_number(second_digit, feminine) unless second_digit == 0
|
79
|
+
return output
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.hundreds(digits, feminine=nil)
|
83
|
+
final_digits = digits.to_s[1..3].to_i
|
84
|
+
first_digit = digits.to_s[0].to_i
|
85
|
+
case first_digit
|
86
|
+
when 1 then hh = "сто"
|
87
|
+
when 2 then hh = "двеста"
|
88
|
+
when 3 then hh = "триста"
|
89
|
+
when 4..9 then hh = basic_number(first_digit)+"стотин"
|
90
|
+
end
|
91
|
+
output = hh
|
92
|
+
case final_digits
|
93
|
+
when 1..20 then output += " и "
|
94
|
+
end
|
95
|
+
output += " " + levs_slovom(final_digits, feminine) unless final_digits == 0
|
96
|
+
return output.gsub(/\s+/, " ").strip
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.thousands(digits, feminine=nil)
|
100
|
+
count = digits.to_s.length
|
101
|
+
case count
|
102
|
+
when 4 then
|
103
|
+
small = digits.to_s[0].to_i
|
104
|
+
small == 1 ? hh = "хиляда " : hh = levs_slovom(small, feminine = true) + " хиляди "
|
105
|
+
big = digits.to_s[1..3].to_i
|
106
|
+
when 5 then
|
107
|
+
small = digits.to_s[0..1].to_i
|
108
|
+
hh = levs_slovom(small, feminine = true) + " хиляди "
|
109
|
+
big = digits.to_s[2..4].to_i
|
110
|
+
when 6 then
|
111
|
+
small = digits.to_s[0..2].to_i
|
112
|
+
hh = levs_slovom(small, feminine = true) + " хиляди "
|
113
|
+
big = digits.to_s[3..5].to_i
|
114
|
+
end
|
115
|
+
output = hh
|
116
|
+
output += " и " unless (levs_slovom(big).include?(" и ") && big.to_s.length == 3) or levs_slovom(big) == "много"
|
117
|
+
output += levs_slovom(big) unless big == 0
|
118
|
+
return output.gsub(/\s+/, " ").strip
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.gazillions(digits, feminine=nil)
|
122
|
+
count = digits.to_s.length
|
123
|
+
case count
|
124
|
+
when 7..9 then
|
125
|
+
base_count = 7
|
126
|
+
word_plural = " милиона "; word_singular = " милион "
|
127
|
+
when 10..12 then
|
128
|
+
base_count = 10
|
129
|
+
word_plural = " милиарда "; word_singular = " милиард "
|
130
|
+
when 13..15 then
|
131
|
+
base_count = 13
|
132
|
+
word_plural = " трилиона "; word_singular = " трилион "
|
133
|
+
end
|
134
|
+
if count == base_count
|
135
|
+
big_number = digits.to_s[0].to_i
|
136
|
+
small_number = digits.to_s[1..24].to_i
|
137
|
+
elsif count == base_count + 1
|
138
|
+
big_number = digits.to_s[0..1].to_i
|
139
|
+
small_number = digits.to_s[2..24].to_i
|
140
|
+
elsif count == base_count + 2
|
141
|
+
big_number = digits.to_s[0..2].to_i
|
142
|
+
small_number = digits.to_s[3..24].to_i
|
143
|
+
end
|
144
|
+
big_number == 1 ? word = word_singular : word = word_plural
|
145
|
+
|
146
|
+
output = levs_slovom(big_number) + word
|
147
|
+
output += " и " unless levs_slovom(small_number).include? " и " or levs_slovom(small_number) == "много"
|
148
|
+
output += levs_slovom(small_number) unless levs_slovom(small_number) == "много"
|
149
|
+
return output.gsub(/\s+/, " ").strip
|
150
|
+
end
|
151
|
+
end
|
data/slovom.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/slovom/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Svilen Vassilev"]
|
6
|
+
gem.email = ["svilen@rubystudio.net"]
|
7
|
+
gem.description = %q{Converts decimal currency numbers into text in Bulgarian language. For use in financial applications, documents, and all other instances requiring currency verbalization.}
|
8
|
+
gem.summary = %q{Converts decimal currency numbers into text in Bulgarian language}
|
9
|
+
gem.homepage = "https://github.com/tarakanbg/slovom"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "slovom"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Slovom::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency "rspec"
|
19
|
+
gem.add_development_dependency "rake"
|
20
|
+
end
|
File without changes
|
data/spec/slovom_spec.rb
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'bigdecimal'
|
3
|
+
require 'spec_helper.rb'
|
4
|
+
#require 'string'
|
5
|
+
#require 'integer'
|
6
|
+
|
7
|
+
describe BigDecimal do
|
8
|
+
|
9
|
+
describe "input" do
|
10
|
+
it "rounds correctly" do
|
11
|
+
input = BigDecimal.new("10.202")
|
12
|
+
input.round(2).should eq(BigDecimal.new("10.20"))
|
13
|
+
input.round(2).to_s.should eq(BigDecimal.new("10.20").to_s)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "splits levs" do
|
17
|
+
input = BigDecimal.new("10.20")
|
18
|
+
levs = input.fix.to_i
|
19
|
+
levs.should eq(10)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "splits stotinki" do
|
23
|
+
input = BigDecimal.new("10.20")
|
24
|
+
stotinki = input.frac.to_s('F').gsub("0.", '')
|
25
|
+
stotinki.should eq("2")
|
26
|
+
stotinki = stotinki+"0" if stotinki.length == 1
|
27
|
+
stotinki.should eq("20")
|
28
|
+
stotinki = stotinki.to_i
|
29
|
+
stotinki.should eq(20)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe ".slovom" do
|
34
|
+
it "converts stotinki into a valid string" do
|
35
|
+
number = BigDecimal.new("00.56")
|
36
|
+
number.slovom.should eq("петдесет и шест стотинки")
|
37
|
+
|
38
|
+
number = BigDecimal.new("00.05")
|
39
|
+
number.slovom.should eq("пет стотинки")
|
40
|
+
|
41
|
+
number = BigDecimal.new("00.12")
|
42
|
+
number.slovom.should eq("дванадесет стотинки")
|
43
|
+
|
44
|
+
number = BigDecimal.new("00.23")
|
45
|
+
number.slovom.should eq("двадесет и три стотинки")
|
46
|
+
|
47
|
+
number = BigDecimal.new("00.99")
|
48
|
+
number.slovom.should eq("деветдесет и девет стотинки")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "converts levs and stotinki combo into a valid string" do
|
52
|
+
number = BigDecimal.new("1.56")
|
53
|
+
number.slovom.should eq("един лев и петдесет и шест стотинки")
|
54
|
+
|
55
|
+
number = BigDecimal.new("3.05")
|
56
|
+
number.slovom.should eq("три лева и пет стотинки")
|
57
|
+
|
58
|
+
number = BigDecimal.new("10.20")
|
59
|
+
number.slovom.should eq("десет лева и двадесет стотинки")
|
60
|
+
|
61
|
+
number = BigDecimal.new("20.30")
|
62
|
+
number.slovom.should eq("двадесет лева и тридесет стотинки")
|
63
|
+
|
64
|
+
number = BigDecimal.new("14.12")
|
65
|
+
number.slovom.should eq("четиринадесет лева и дванадесет стотинки")
|
66
|
+
|
67
|
+
number = BigDecimal.new("71.23")
|
68
|
+
number.slovom.should eq("седемдесет и един лева и двадесет и три стотинки")
|
69
|
+
|
70
|
+
number = BigDecimal.new("101.99")
|
71
|
+
number.slovom.should eq("сто и един лева и деветдесет и девет стотинки")
|
72
|
+
|
73
|
+
number = BigDecimal.new("514.76")
|
74
|
+
number.slovom.should eq("петстотин и четиринадесет лева и седемдесет и шест стотинки")
|
75
|
+
|
76
|
+
number = BigDecimal.new("1264.34")
|
77
|
+
number.slovom.should eq("хиляда двеста шестдесет и четири лева и тридесет и четири стотинки")
|
78
|
+
|
79
|
+
number = BigDecimal.new("5317.04")
|
80
|
+
number.slovom.should eq("пет хиляди триста и седемнадесет лева и четири стотинки")
|
81
|
+
|
82
|
+
number = BigDecimal.new("14000.15")
|
83
|
+
number.slovom.should eq("четиринадесет хиляди лева и петнадесет стотинки")
|
84
|
+
|
85
|
+
number = BigDecimal.new("78381.92")
|
86
|
+
number.slovom.should eq("седемдесет и осем хиляди триста осемдесет и един лева и деветдесет и две стотинки")
|
87
|
+
|
88
|
+
number = BigDecimal.new("132011.16")
|
89
|
+
number.slovom.should eq("сто тридесет и две хиляди и единадесет лева и шестнадесет стотинки")
|
90
|
+
|
91
|
+
number = BigDecimal.new("1783085.21")
|
92
|
+
number.slovom.should eq("един милион седемстотин осемдесет и три хиляди и осемдесет и пет лева и двадесет и една стотинки")
|
93
|
+
|
94
|
+
number = BigDecimal.new("11316081.07")
|
95
|
+
number.slovom.should eq("единадесет милиона триста и шестнадесет хиляди и осемдесет и един лева и седем стотинки")
|
96
|
+
|
97
|
+
number = BigDecimal.new("159354101.33")
|
98
|
+
number.slovom.should eq("сто петдесет и девет милиона триста петдесет и четири хиляди сто и един лева и тридесет и три стотинки")
|
99
|
+
|
100
|
+
number = BigDecimal.new("56237203102.71")
|
101
|
+
number.slovom.should eq("петдесет и шест милиарда двеста тридесет и седем милиона двеста и три хиляди сто и два лева и седемдесет и една стотинки")
|
102
|
+
|
103
|
+
number = BigDecimal.new("31804319906444.10")
|
104
|
+
number.slovom.should eq("тридесет и един трилиона осемстотин и четири милиарда триста и деветнадесет милиона деветстотин и шест хиляди четиристотин четиридесет и четири лева и десет стотинки")
|
105
|
+
|
106
|
+
number = BigDecimal.new("1.01")
|
107
|
+
number.slovom.should eq("един лев и една стотинка")
|
108
|
+
end
|
109
|
+
|
110
|
+
it "converts levs into a valid string" do
|
111
|
+
number = BigDecimal.new("1.00")
|
112
|
+
number.slovom.should eq("един лев")
|
113
|
+
|
114
|
+
number = BigDecimal.new("2.00")
|
115
|
+
number.slovom.should eq("два лева")
|
116
|
+
|
117
|
+
number = BigDecimal.new("14.00")
|
118
|
+
number.slovom.should eq("четиринадесет лева")
|
119
|
+
|
120
|
+
number = BigDecimal.new("17.00")
|
121
|
+
number.slovom.should eq("седемнадесет лева")
|
122
|
+
|
123
|
+
number = BigDecimal.new("18.00")
|
124
|
+
number.slovom.should eq("осемнадесет лева")
|
125
|
+
|
126
|
+
number = BigDecimal.new("20.00")
|
127
|
+
number.slovom.should eq("двадесет лева")
|
128
|
+
|
129
|
+
number = BigDecimal.new("30.00")
|
130
|
+
number.slovom.should eq("тридесет лева")
|
131
|
+
|
132
|
+
number = BigDecimal.new("76.00")
|
133
|
+
number.slovom.should eq("седемдесет и шест лева")
|
134
|
+
|
135
|
+
number = BigDecimal.new("293.00")
|
136
|
+
number.slovom.should eq("двеста деветдесет и три лева")
|
137
|
+
|
138
|
+
number = BigDecimal.new("303.00")
|
139
|
+
number.slovom.should eq("триста и три лева")
|
140
|
+
|
141
|
+
number = BigDecimal.new("452.00")
|
142
|
+
number.slovom.should eq("четиристотин петдесет и два лева")
|
143
|
+
|
144
|
+
number = BigDecimal.new("811.00")
|
145
|
+
number.slovom.should eq("осемстотин и единадесет лева")
|
146
|
+
|
147
|
+
number = BigDecimal.new("1000.00")
|
148
|
+
number.slovom.should eq("хиляда лева")
|
149
|
+
|
150
|
+
number = BigDecimal.new("1200.00")
|
151
|
+
number.slovom.should eq("хиляда и двеста лева")
|
152
|
+
|
153
|
+
number = BigDecimal.new("1407.00")
|
154
|
+
number.slovom.should eq("хиляда четиристотин и седем лева")
|
155
|
+
|
156
|
+
number = BigDecimal.new("2000.00")
|
157
|
+
number.slovom.should eq("две хиляди лева")
|
158
|
+
|
159
|
+
number = BigDecimal.new("2800.00")
|
160
|
+
number.slovom.should eq("две хиляди и осемстотин лева")
|
161
|
+
|
162
|
+
number = BigDecimal.new("10000.00")
|
163
|
+
number.slovom.should eq("десет хиляди лева")
|
164
|
+
|
165
|
+
number = BigDecimal.new("14100.00")
|
166
|
+
number.slovom.should eq("четиринадесет хиляди и сто лева")
|
167
|
+
|
168
|
+
number = BigDecimal.new("59374.00")
|
169
|
+
number.slovom.should eq("петдесет и девет хиляди триста седемдесет и четири лева")
|
170
|
+
|
171
|
+
number = BigDecimal.new("100000.00")
|
172
|
+
number.slovom.should eq("сто хиляди лева")
|
173
|
+
|
174
|
+
number = BigDecimal.new("200300.00")
|
175
|
+
number.slovom.should eq("двеста хиляди и триста лева")
|
176
|
+
|
177
|
+
number = BigDecimal.new("776315.00")
|
178
|
+
number.slovom.should eq("седемстотин седемдесет и шест хиляди триста и петнадесет лева")
|
179
|
+
|
180
|
+
number = BigDecimal.new("1000000.00")
|
181
|
+
number.slovom.should eq("един милион лева")
|
182
|
+
|
183
|
+
number = BigDecimal.new("156320010.00")
|
184
|
+
number.slovom.should eq("сто петдесет и шест милиона триста и двадесет хиляди и десет лева")
|
185
|
+
|
186
|
+
number = BigDecimal.new("1000001.00")
|
187
|
+
number.slovom.should eq("един милион и един лева")
|
188
|
+
|
189
|
+
number = BigDecimal.new("1000000000.00")
|
190
|
+
number.slovom.should eq("един милиард лева")
|
191
|
+
|
192
|
+
number = BigDecimal.new("121000000000.00")
|
193
|
+
number.slovom.should eq("сто двадесет и един милиарда лева")
|
194
|
+
|
195
|
+
number = BigDecimal.new("1000000000000.00")
|
196
|
+
number.slovom.should eq("един трилион лева")
|
197
|
+
|
198
|
+
number = BigDecimal.new("511000000000000.00")
|
199
|
+
number.slovom.should eq("петстотин и единадесет трилиона лева")
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'slovom'
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slovom
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Svilen Vassilev
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Converts decimal currency numbers into text in Bulgarian language. For
|
47
|
+
use in financial applications, documents, and all other instances requiring currency
|
48
|
+
verbalization.
|
49
|
+
email:
|
50
|
+
- svilen@rubystudio.net
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- .rspec
|
57
|
+
- .travis.yml
|
58
|
+
- CHANGELOG.md
|
59
|
+
- Gemfile
|
60
|
+
- LICENSE
|
61
|
+
- README.md
|
62
|
+
- Rakefile
|
63
|
+
- lib/slovom.rb
|
64
|
+
- lib/slovom/version.rb
|
65
|
+
- slovom.gemspec
|
66
|
+
- spec/slovom/slovom_spec.rb
|
67
|
+
- spec/slovom_spec.rb
|
68
|
+
- spec/spec_helper.rb
|
69
|
+
homepage: https://github.com/tarakanbg/slovom
|
70
|
+
licenses: []
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.8.21
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Converts decimal currency numbers into text in Bulgarian language
|
93
|
+
test_files:
|
94
|
+
- spec/slovom/slovom_spec.rb
|
95
|
+
- spec/slovom_spec.rb
|
96
|
+
- spec/spec_helper.rb
|