parayaz 1.0.1 → 1.0.2

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: 1b401faef3d5e48ece97e8befbad13e587fe66f1
4
- data.tar.gz: 799d00dfb2b07b963d31900311ba09a653b62465
3
+ metadata.gz: 0457a8cb09aaeba7dc91857bcd8486b11fae5288
4
+ data.tar.gz: c93348704c2deefff4b9e9711db2f64843f0848e
5
5
  SHA512:
6
- metadata.gz: d188cbd9991103b2630b12c016eace656872c01271eb1666114bbdcf08a29e82b55f0569bc6d85e8baaa60db655e5fd4150abff453dc14c834f53fbe0b2d2405
7
- data.tar.gz: 633dfb8cafbe85d564eb271a7627874b84c2d27488ac3fc291d69b550c6ca35f08402be8f31190d2395f3bd766dd9e2160f7fe129d29355b7dd627ee4433f8d9
6
+ metadata.gz: 86637dd4b6852677133984f444e18c693d35c58f5e50a8d8a6915761cf50682c6f95aa203b19602a249f69d734d71a6405ab9eadbfc6afdcbd5e4549f938c699
7
+ data.tar.gz: deae787fd19182b68286fe18d5f3e0c32899d3fe0ea9fe9f4642cc16934339d8936956da9bd84c31bfba4582f46649809a5d4b5ab51ca6c77a3cb1187e49d6a6
data/.gitignore CHANGED
@@ -1,15 +1,104 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
1
+ # Created by http://www.gitignore.io
2
+
3
+ ### Ruby ###
4
+ *.gem
5
+ *.rbc
6
+ /.config
5
7
  /coverage/
6
- /doc/
8
+ /InstalledFiles
7
9
  /pkg/
8
10
  /spec/reports/
11
+ /test/tmp/
12
+ /test/version_tmp/
9
13
  /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
14
+
15
+ ## Specific to RubyMotion:
16
+ .dat*
17
+ .repl_history
18
+ build/
19
+
20
+ ## Documentation cache and generated files:
21
+ /.yardoc/
22
+ /_yardoc/
23
+ /doc/
24
+ /rdoc/
25
+
26
+ ## Environment normalisation:
27
+ /.bundle/
28
+ /lib/bundler/man/
29
+
30
+ # for a library or gem, you might want to ignore these files since the code is
31
+ # intended to run in multiple environments; otherwise, check them in:
32
+ # Gemfile.lock
33
+ # .ruby-version
34
+ # .ruby-gemset
35
+
36
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
37
+ .rvmrc
38
+
39
+
40
+ ### RubyMine ###
41
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
42
+
43
+ ## Directory-based project format
15
44
  .idea/
45
+ /*.iml
46
+ # if you remove the above rule, at least ignore user-specific stuff:
47
+ # .idea/workspace.xml
48
+ # .idea/tasks.xml
49
+ # .idea/dictionaries
50
+ # and these sensitive or high-churn files:
51
+ # .idea/dataSources.ids
52
+ # .idea/dataSources.xml
53
+ # .idea/sqlDataSources.xml
54
+ # .idea/dynamic.xml
55
+ # and, if using gradle::
56
+ # .idea/gradle.xml
57
+ # .idea/libraries
58
+
59
+ ## File-based project format
60
+ *.ipr
61
+ *.iws
62
+
63
+ ## Additional for IntelliJ
64
+ out/
65
+
66
+ # generated by mpeltonen/sbt-idea plugin
67
+ .idea_modules/
68
+
69
+ # generated by JIRA plugin
70
+ atlassian-ide-plugin.xml
71
+
72
+ # generated by Crashlytics plugin (for Android Studio and Intellij)
73
+ com_crashlytics_export_strings.xml
74
+
75
+
76
+ ### OSX ###
77
+ .DS_Store
78
+ .AppleDouble
79
+ .LSOverride
80
+
81
+ # Icon must end with two \r
82
+ Icon
83
+
84
+
85
+ # Thumbnails
86
+ ._*
87
+
88
+ # Files that might appear on external disk
89
+ .Spotlight-V100
90
+ .Trashes
91
+
92
+ # Directories potentially created on remote AFP share
93
+ .AppleDB
94
+ .AppleDesktop
95
+ Network Trash Folder
96
+ Temporary Items
97
+ .apdisk
98
+
99
+
100
+ ### Linux ###
101
+ *~
102
+
103
+ # KDE directory preferences
104
+ .directory
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
 
2
2
  #### [Current]
3
+ * [e14b059](../../commit/e14b059) - __(Ahmet Sezgin Duran)__ [#1](../../issues/1) Fix negative number error
3
4
 
5
+ #### 1.0.1
6
+ * [52a9cd6](../../commit/52a9cd6) - __(Murat Kemal BAYGÜN)__ Remove kr if zero (0)
4
7
 
5
8
  #### 1.0.0
6
9
  * [7c6ca13](../../commit/7c6ca13) - __(Muhammet Dilek)__ bump version 1.0.0
@@ -9,6 +12,6 @@
9
12
  * [894aaef](../../commit/894aaef) - __(Muhammet Dilek)__ licence added and readme fixed
10
13
  * [103ef64](../../commit/103ef64) - __(Muhammet Dilek)__ update readme
11
14
  * [3d0c5c7](../../commit/3d0c5c7) - __(Muhammet Dilek)__ update readme
12
- * [3ee8122](../../commit/3ee8122) - __(Murat Kemal BAYGN)__ Fix writing for One Hundred
15
+ * [3ee8122](../../commit/3ee8122) - __(Murat Kemal BAYGÜN)__ Fix writing for One Hundred
13
16
  * [6204e7c](../../commit/6204e7c) - __(Muhammet Dilek)__ gem created
14
17
  * [7dee40d](../../commit/7dee40d) - __(Muhammet Dilek)__ Initial commit
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ parayaz (1.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.2.5)
10
+ rake (10.3.2)
11
+ rspec (3.0.0)
12
+ rspec-core (~> 3.0.0)
13
+ rspec-expectations (~> 3.0.0)
14
+ rspec-mocks (~> 3.0.0)
15
+ rspec-core (3.0.4)
16
+ rspec-support (~> 3.0.0)
17
+ rspec-expectations (3.0.4)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.0.0)
20
+ rspec-mocks (3.0.4)
21
+ rspec-support (~> 3.0.0)
22
+ rspec-support (3.0.4)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ bundler (~> 1.6)
29
+ parayaz!
30
+ rake (~> 10.0)
31
+ rspec
@@ -1,3 +1,3 @@
1
1
  module Parayaz
2
- VERSION = "1.0.1"
2
+ VERSION = '1.0.2'
3
3
  end
data/lib/parayaz.rb CHANGED
@@ -1,68 +1,24 @@
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 && cents.to_i > 0
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
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'
68
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parayaz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - lab2023
@@ -62,6 +62,7 @@ files:
62
62
  - ".gitignore"
63
63
  - CHANGELOG.md
64
64
  - Gemfile
65
+ - Gemfile.lock
65
66
  - LICENSE.txt
66
67
  - README.md
67
68
  - Rakefile