parayaz 1.0.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 +7 -0
- data/.gitignore +15 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/Rakefile +2 -0
- data/lib/parayaz/version.rb +3 -0
- data/lib/parayaz.rb +68 -0
- data/parayaz.gemspec +24 -0
- data/spec/parayaz_spec.rb +5 -0
- data/spec/spec_helper.rb +10 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ad1844d8747b79c197aac93184957d9e21df0bb
|
4
|
+
data.tar.gz: be78d1e3ad9c6836b2e873024710be1141a8402b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 56b0a1fd7ad0be96997e4be5fdaa2dbab2266db8b6d409c73bca98548b4126bb2b3f0abaf13a7231ebec56930f9da4f8208a009cef867db21a8b61c55a272994
|
7
|
+
data.tar.gz: dcd6ad4845f1d233daf508a0d2ec6c84d89c47f372491381314d792c07c6c0cf60036b3a56b60f9bfe565911b988b15c223061adb196cdf72cf8130d72a54dde
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
#### [Current]
|
3
|
+
|
4
|
+
####
|
5
|
+
* [f3e609f](../../commit/f3e609f) - __(Muhammet Dilek)__ dot added to text
|
6
|
+
* [767d851](../../commit/767d851) - __(Muhammet Dilek)__ cents fixed
|
7
|
+
* [894aaef](../../commit/894aaef) - __(Muhammet Dilek)__ licence added and readme fixed
|
8
|
+
* [103ef64](../../commit/103ef64) - __(Muhammet Dilek)__ update readme
|
9
|
+
* [3d0c5c7](../../commit/3d0c5c7) - __(Muhammet Dilek)__ update readme
|
10
|
+
* [3ee8122](../../commit/3ee8122) - __(Murat Kemal BAYGN)__ Fix writing for One Hundred
|
11
|
+
* [6204e7c](../../commit/6204e7c) - __(Muhammet Dilek)__ gem created
|
12
|
+
* [7dee40d](../../commit/7dee40d) - __(Muhammet Dilek)__ Initial commit
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 lab2023
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Parayaz
|
2
|
+
|
3
|
+
Turkish number to text money
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'parayaz'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install parayaz
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
```ruby
|
23
|
+
> 123.parayaz
|
24
|
+
# yüzyirmiüçTL
|
25
|
+
|
26
|
+
> 123.55.parayaz
|
27
|
+
# yüzyirmiüçTL,ellibeşkr
|
28
|
+
```
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it ( https://github.com/lab2023/parayaz/fork )
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create a new Pull Request
|
37
|
+
|
38
|
+
## Credits
|
39
|
+
|
40
|
+

|
41
|
+
|
42
|
+
- BinChecker is maintained and funded by [lab2023 - information technologies](http://lab2023.com/)
|
43
|
+
- Thank you to all the [contributors!](https://github.com/kebab-project/kangal/graphs/contributors)
|
44
|
+
- The names and logos for lab2023 are trademarks of lab2023, inc.
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
Copyright 2014 lab2023 - information technologies
|
data/Rakefile
ADDED
data/lib/parayaz.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require "parayaz/version"
|
2
|
+
|
3
|
+
module Parayaz
|
4
|
+
def parayaz
|
5
|
+
number = self
|
6
|
+
|
7
|
+
price, cents = number.to_s.split('.')
|
8
|
+
|
9
|
+
text = convert_to_text(price) + 'TL'
|
10
|
+
if cents
|
11
|
+
if cents.size == 1
|
12
|
+
cents = (cents.to_i * 10).to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
if cents.size > 2
|
16
|
+
cents = cents[0..1]
|
17
|
+
end
|
18
|
+
|
19
|
+
text += ',' + convert_to_text(cents) + 'kr'
|
20
|
+
end
|
21
|
+
|
22
|
+
text + '.'
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def say_1_digit_text(n)
|
27
|
+
one_digits_text = ['', 'bir', 'iki', 'üç', 'dört', 'beş', 'altı', 'yedi', 'sekiz', 'dokuz']
|
28
|
+
one_digits_text[n]
|
29
|
+
end
|
30
|
+
|
31
|
+
def say_2_digit_text(n)
|
32
|
+
two_digits_text = ['', 'on', 'yirmi', 'otuz', 'kırk', 'elli', 'altmış', 'yetmiş', 'seksen', 'doksan']
|
33
|
+
two_digits_text[n[0]] + say_1_digit_text(n[1])
|
34
|
+
end
|
35
|
+
|
36
|
+
def say_3_digit_text(n)
|
37
|
+
one = n[0] == 1 ? 'yüz' : say_1_digit_text(n[0])
|
38
|
+
one += 'yüz' unless n[0] == 1 || n[0] == 0
|
39
|
+
n.delete_at(0)
|
40
|
+
one + say_2_digit_text(n)
|
41
|
+
end
|
42
|
+
|
43
|
+
def convert_to_text(number)
|
44
|
+
number = number.to_i
|
45
|
+
lots = ['', 'bin', 'milyon', 'milyar', 'trilyon', 'katrilyon', 'kentilyon', 'seksilyon', 'septilyon']
|
46
|
+
|
47
|
+
text = ''
|
48
|
+
|
49
|
+
i = 0
|
50
|
+
while !number.zero?
|
51
|
+
number, r = number.divmod(1000)
|
52
|
+
size = r.to_s.split('').map(&:to_i).size
|
53
|
+
new_text = r == 1 && i == 1 ? "" : eval("say_#{size}_digit_text(#{size == 1 ? r : r.to_s.split('').map(&:to_i)})")
|
54
|
+
|
55
|
+
unless r == 0
|
56
|
+
new_text += lots[i]
|
57
|
+
end
|
58
|
+
|
59
|
+
text = new_text + text
|
60
|
+
i += 1
|
61
|
+
end
|
62
|
+
text
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class Numeric
|
67
|
+
include Parayaz
|
68
|
+
end
|
data/parayaz.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'parayaz/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "parayaz"
|
8
|
+
spec.version = Parayaz::VERSION
|
9
|
+
spec.authors = ["lab2023"]
|
10
|
+
spec.email = ["info@lab2023.com"]
|
11
|
+
spec.summary = %q{Turkish number to text money}
|
12
|
+
spec.description = %q{Turkish number to text money}
|
13
|
+
spec.homepage = "https://github.com/lab2023/parayaz"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'parayaz'
|
2
|
+
|
3
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
4
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
5
|
+
# run as spec files by default. This means that files in spec/support that end
|
6
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
7
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
8
|
+
# end with _spec.rb. You can configure this pattern with with the --pattern
|
9
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
10
|
+
Dir[File.expand_path('spec/support/**/*.rb')].each(&method(:require)) #{ |f| require f }
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: parayaz
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- lab2023
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Turkish number to text money
|
56
|
+
email:
|
57
|
+
- info@lab2023.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/parayaz.rb
|
69
|
+
- lib/parayaz/version.rb
|
70
|
+
- parayaz.gemspec
|
71
|
+
- spec/parayaz_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
homepage: https://github.com/lab2023/parayaz
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.1
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Turkish number to text money
|
97
|
+
test_files:
|
98
|
+
- spec/parayaz_spec.rb
|
99
|
+
- spec/spec_helper.rb
|
100
|
+
has_rdoc:
|