nums2fa 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 412465d527a50566eb4767fe4863cd529841de91
4
- data.tar.gz: edbd4b7c36c0b9940e82580bc318f2b5381f11b1
3
+ metadata.gz: 32656095974702f80b86b4d63485658e095d7eac
4
+ data.tar.gz: 2d2861f87f482a758d81b14f5321e151b47c49f6
5
5
  SHA512:
6
- metadata.gz: 2624188156a0b2a30fa2cd48af4e1c43c042a9f524e8984db7a711d25b86fbc5d81b77e4b1c33fb26aa01a03643b4c14aa03b00ad42f090057e0c932d321558f
7
- data.tar.gz: 9025dfc2c785a265f2ff0f8ba8ca82e04bfdcb8f7b1131c39c17fc615992089682a869664e498e72f47e72e47dd19ab07bc8a84ebfda55d0b96d43d682194c3d
6
+ metadata.gz: 621bcb02c5849fceac8f49a2a6997a2427ef68457486767ab6aff6b62973382d4c2da9ceed8fda22f9323aafd68e7fd7519b073d4ea178efc38b625ad8452122
7
+ data.tar.gz: 4a9dc058cab8b40f94ea49f2779d4470cc01d70ea6ad1b765f95659116b1b31c11954c527cfeb009d41fbb8e2e5858888c36beaa38704ad6d7b0002fc47416eb
@@ -1,20 +1,21 @@
1
- Copyright 2016 Mohsen Alizadeh
1
+ MIT License
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
3
+ Copyright (c) 2016 Mohsen Alizadeh
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
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:
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.
@@ -0,0 +1,24 @@
1
+ = Nums2fa
2
+
3
+ nums2fa is simple gem to convert English numbers and Persian numbers together.
4
+
5
+ == install
6
+
7
+ * put nums2fa in Gemfile
8
+
9
+ gem 'nums2fa'
10
+
11
+ * run bunle install
12
+
13
+ bundle install
14
+
15
+
16
+ == Usages
17
+
18
+ * Convert English numbers to Persian numbers
19
+
20
+ "1368-11-09".nums2fa # => '۱۳۶۸-۱۱-۰۹'
21
+
22
+ * Convert Persian numbers to English numbers
23
+
24
+ "۱۳۶۸-۱۱-۰۹".nums2en # => "1368-11-09"
@@ -7,5 +7,12 @@ class String
7
7
  def nums2fa!
8
8
  self.replace(nums2fa)
9
9
  end
10
- end
11
10
 
11
+ def nums2en
12
+ self.tr('۰۱۲۳۴۵۶۷۸۹', '0123456789')
13
+ end
14
+
15
+ def nums2en!
16
+ self.replace(nums2en)
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Nums2fa
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nums2fa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohsen Alizadeh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-01 00:00:00.000000000 Z
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: nums2fa
13
+ description: Convert Persian numbers to English numbers and vice versa.
14
14
  email:
15
15
  - mohsen@alizadeh.us
16
16
  executables: []
@@ -19,12 +19,12 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - MIT-LICENSE
21
21
  - README.rdoc
22
- - Rakefile
23
22
  - lib/nums2fa.rb
24
23
  - lib/nums2fa/string.rb
25
24
  - lib/nums2fa/version.rb
26
25
  homepage: https://github.com/mohsen-alizadeh/nums2fa
27
- licenses: []
26
+ licenses:
27
+ - MIT
28
28
  metadata: {}
29
29
  post_install_message:
30
30
  rdoc_options: []
@@ -32,17 +32,17 @@ require_paths:
32
32
  - lib
33
33
  required_ruby_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - '>='
35
+ - - ">="
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.4.8
45
+ rubygems_version: 2.6.6
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: nums2fa
data/Rakefile DELETED
@@ -1,32 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'nums2fa'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
-
19
-
20
- Bundler::GemHelper.install_tasks
21
-
22
- require 'rake/testtask'
23
-
24
- Rake::TestTask.new(:test) do |t|
25
- t.libs << 'lib'
26
- t.libs << 'test'
27
- t.pattern = 'test/**/*_test.rb'
28
- t.verbose = false
29
- end
30
-
31
-
32
- task default: :test