parayaz 1.0.3 → 1.0.4

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: fa269eaa8b3e3d602997d6f88bc06cbe62f5dc33
4
- data.tar.gz: 2d9fc903a199bcab36e1337fd738ca0a3627ef1c
3
+ metadata.gz: a06c75164343226a717d0136cc05decee5b86e8c
4
+ data.tar.gz: 57a03d709fab7170d2d0313d8d7382291f5ace9e
5
5
  SHA512:
6
- metadata.gz: 9280f4d07cdb5f95e9f465e9307506d016dc1d32941d52317f47d11273511897795545ce288f63dde5c59e3b608a0c01fde987eca1a9dc76c8883426d4410216
7
- data.tar.gz: ea61fe601be6dfe71d0b46ba6a639aec1ad16048b2cd4f2e0747165acb61710dd8078f3e5e5be6f1b1b3a9873c035393cd8658941b43a09a824e52390efe0552
6
+ metadata.gz: bd4bea3e3afaa054bca9d286df2428f8b4bb2111f3c26682bbc640d4ad85700eeb6f0e69a3c8dfde58d7e9e1acae1bca370848ef833bf34c0eed914f57cd17fb
7
+ data.tar.gz: db9334038783112a630fcd0b7b9e6a49fae35ce1173de76593c0edd4212bfced4c2a9057a5684148cd2f0354729d2b6b38060ebe807377c696878f7bf9b69471
data/.gitignore CHANGED
@@ -102,3 +102,5 @@ Temporary Items
102
102
 
103
103
  # KDE directory preferences
104
104
  .directory
105
+
106
+ vendor/bundle
@@ -1,5 +1,9 @@
1
1
 
2
2
  #### [Current]
3
+ * [f26aa42](../../commit/f26aa42) - __(Ahmet Sezgin Duran)__ Fix README
4
+
5
+ #### 1.0.3
6
+ * [e66b758](../../commit/e66b758) - __(Ahmet Sezgin Duran)__ Bump version 1.0.3
3
7
  * [a347fd7](../../commit/a347fd7) - __(Ahmet Sezgin Duran)__ Revert back to original file
4
8
 
5
9
  #### 1.0.2
@@ -7,7 +11,7 @@
7
11
  * [e14b059](../../commit/e14b059) - __(Ahmet Sezgin Duran)__ [#1](../../issues/1) Fix negative number error
8
12
 
9
13
  #### 1.0.1
10
- * [52a9cd6](../../commit/52a9cd6) - __(Murat Kemal BAYGÜN)__ Remove kr if zero (0)
14
+ * [52a9cd6](../../commit/52a9cd6) - __(Murat Kemal BAYGN)__ Remove kr if zero (0)
11
15
 
12
16
  #### 1.0.0
13
17
  * [7c6ca13](../../commit/7c6ca13) - __(Muhammet Dilek)__ bump version 1.0.0
@@ -16,6 +20,6 @@
16
20
  * [894aaef](../../commit/894aaef) - __(Muhammet Dilek)__ licence added and readme fixed
17
21
  * [103ef64](../../commit/103ef64) - __(Muhammet Dilek)__ update readme
18
22
  * [3d0c5c7](../../commit/3d0c5c7) - __(Muhammet Dilek)__ update readme
19
- * [3ee8122](../../commit/3ee8122) - __(Murat Kemal BAYGÜN)__ Fix writing for One Hundred
23
+ * [3ee8122](../../commit/3ee8122) - __(Murat Kemal BAYGN)__ Fix writing for One Hundred
20
24
  * [6204e7c](../../commit/6204e7c) - __(Muhammet Dilek)__ gem created
21
25
  * [7dee40d](../../commit/7dee40d) - __(Muhammet Dilek)__ Initial commit
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parayaz (1.0.2)
4
+ parayaz (1.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Parayaz
2
2
 
3
- Turkish number to text money
3
+ Turkish number to text money according to [TDK][1000]
4
4
 
5
5
  ## Installation
6
6
 
@@ -14,17 +14,25 @@ And then execute:
14
14
 
15
15
  $ bundle
16
16
 
17
+ Or
18
+
19
+ $ bundle install --path=vendor/bundle
20
+
17
21
  Or install it yourself as:
18
22
 
19
23
  $ gem install parayaz
20
24
 
25
+ ## Tests
26
+
27
+ Use `rake test` or `bundle exec rake test` to run specs.
28
+
21
29
  ## Usage
22
30
  ```ruby
23
31
  > 123.parayaz
24
32
  # yüzyirmiüçTL
25
33
 
26
34
  > 123.55.parayaz
27
- # yüzyirmiüçTL,ellibeşkr
35
+ # yüzyirmiüçTL,ellibeşkr.
28
36
  ```
29
37
 
30
38
  ## Contributing
@@ -46,3 +54,5 @@ Or install it yourself as:
46
54
  ## License
47
55
 
48
56
  Copyright 2014 lab2023 - information technologies
57
+
58
+ [1000]: http://www.tdk.gov.tr/index.php?option=com_content&view=article&id=182:Sayilarin-s
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'bundler/setup'
3
+ require 'rspec/core/rake_task'
2
4
 
5
+ RSpec::Core::RakeTask.new
6
+ desc 'Run Tests'
7
+ task :test => :spec
@@ -9,20 +9,21 @@ module Parayaz
9
9
 
10
10
  price, cents = number.to_s.split('.')
11
11
 
12
- text = convert_to_text(price) + 'TL'
12
+ text = convert_to_text(price)
13
+ text += 'TL' unless text.empty?
14
+
13
15
  if cents && cents.to_i > 0
14
16
  if cents.size == 1
15
17
  cents = (cents.to_i * 10).to_s
16
18
  end
17
-
18
19
  if cents.size > 2
19
20
  cents = cents[0..1]
20
21
  end
21
-
22
- text += ',' + convert_to_text(cents) + 'kr'
22
+ text += ',' unless text.empty?
23
+ text += convert_to_text(cents) + 'kr.'
23
24
  end
24
25
 
25
- (minus ? 'eksi' : '') + text + '.'
26
+ (minus ? 'eksi ' : '') + text
26
27
  end
27
28
 
28
29
  private
@@ -53,7 +54,7 @@ module Parayaz
53
54
  while !number.zero?
54
55
  number, r = number.divmod(1000)
55
56
  size = r.to_s.split('').map(&:to_i).size
56
- new_text = r == 1 && i == 1 ? "" : eval("say_#{size}_digit_text(#{size == 1 ? r : r.to_s.split('').map(&:to_i)})")
57
+ new_text = r == 1 && i == 1 ? '' : eval("say_#{size}_digit_text(#{size == 1 ? r : r.to_s.split('').map(&:to_i)})")
57
58
 
58
59
  unless r == 0
59
60
  new_text += lots[i]
@@ -1,3 +1,3 @@
1
1
  module Parayaz
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
@@ -1,5 +1,51 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Parayaz do
4
+ context 'Test regular numbers' do
5
+ it 'should return: birTL' do
6
+ expect(1.parayaz).to eq 'birTL'
7
+ end
8
+ it 'should return: yüzonbirTL' do
9
+ expect(111.parayaz).to eq 'yüzonbirTL'
10
+ end
11
+ it 'should return: binbeşyüzkırkbirTL' do
12
+ expect(1541.parayaz).to eq 'binbeşyüzkırkbirTL'
13
+ end
14
+ end
4
15
 
16
+ context 'Test float numbers' do
17
+ it 'should return: onikikr.' do
18
+ expect(0.125.parayaz).to eq 'onikikr.'
19
+ end
20
+ it 'should return: birTL,onkr.' do
21
+ expect(1.1.parayaz).to eq 'birTL,onkr.'
22
+ end
23
+ it 'should return: yüzyirmiüçTL,kırkbeşkr.' do
24
+ expect(123.45.parayaz).to eq 'yüzyirmiüçTL,kırkbeşkr.'
25
+ end
26
+ end
27
+
28
+ context 'Test big numbers' do
29
+ it 'should return birmilyonüçyüzkırkikibindörtyüzotuzsekizTL' do
30
+ expect(1342438.parayaz).to eq 'birmilyonüçyüzkırkikibindörtyüzotuzsekizTL'
31
+ end
32
+ it 'should return dokuzmilyarsekizyüzyetmişaltımilyonbeşyüzkırküçbinikiyüzonTL' do
33
+ expect(9876543210.parayaz).to eq 'dokuzmilyarsekizyüzyetmişaltımilyonbeşyüzkırküçbinikiyüzonTL'
34
+ end
35
+ it 'should return sekiztrilyonyüzondokuzmilyarsekizyüzyetmişaltımilyonbeşyüzkırküçbinikiyüzonTL,onikikr.' do
36
+ expect(8119876543210.123456.parayaz).to eq 'sekiztrilyonyüzondokuzmilyarsekizyüzyetmişaltımilyonbeşyüzkırküçbinikiyüzonTL,onikikr.'
37
+ end
38
+ end
39
+
40
+ context 'Test negative numbers' do
41
+ it 'should return eksi birTL' do
42
+ expect(-1.parayaz).to eq 'eksi birTL'
43
+ end
44
+ it 'should return eksi on kr.' do
45
+ expect(-0.1.parayaz).to eq 'eksi onkr.'
46
+ end
47
+ it 'should return eksi elli kr.' do
48
+ expect(-0.5.parayaz).to eq 'eksi ellikr.'
49
+ end
50
+ end
5
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parayaz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - lab2023
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler