akshar 0.0.2 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +9 -56
- data/CODE_OF_CONDUCT.md +0 -13
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -20
- data/LICENSE +0 -22
- data/README.md +0 -44
- data/Rakefile +0 -2
- data/akshar-0.0.1.gem +0 -0
- data/akshar.gemspec +0 -32
- data/bin/console +0 -14
- data/bin/setup +0 -7
- data/lib/akshar/version.rb +0 -3
- data/lib/akshar.rb +0 -103
- data/pkg/akshar-0.0.1.gem +0 -0
- data/spec/akshar_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede90354974e2ce60976146a59e0ac7b7b8425d6
|
4
|
+
data.tar.gz: ea7fdaa83b2492f657392ea133fa3e10384a1866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d1db1588420472dc4dafcd96be3aa031d62e7089c4689134bce8c9dde41dfc413247194c60a5367aaea9c53ef8bb56a7440b0b29e7e520bf31af4bf53b159ac
|
7
|
+
data.tar.gz: 7048113596d0212ec91c8175f93f00e23cd17da39a432ec7f52e58683b71969a536b45dda854f4716ae3af10e372db662d67a07e1055722381fecf977e1922c6
|
metadata
CHANGED
@@ -1,68 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akshar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anup Neupane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.10'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.10'
|
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
|
-
description: This Gem will change Numbers to Nepali Names. example 100.akshar = "रुपैयाँ
|
42
|
-
एक सय मात्र ।"
|
11
|
+
date: 2015-07-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ' Akshar(अक्षर). This Gem will change Numbers to Nepali Names. example
|
14
|
+
100.to_akshar = "रुपैयाँ एक सय मात्र ।"'
|
43
15
|
email:
|
44
16
|
- anupbrt@outlook.com
|
45
|
-
executables:
|
46
|
-
- console
|
47
|
-
- setup
|
17
|
+
executables: []
|
48
18
|
extensions: []
|
49
19
|
extra_rdoc_files: []
|
50
|
-
files:
|
51
|
-
- CODE_OF_CONDUCT.md
|
52
|
-
- Gemfile
|
53
|
-
- Gemfile.lock
|
54
|
-
- LICENSE
|
55
|
-
- README.md
|
56
|
-
- Rakefile
|
57
|
-
- akshar-0.0.1.gem
|
58
|
-
- akshar.gemspec
|
59
|
-
- bin/console
|
60
|
-
- bin/setup
|
61
|
-
- lib/akshar.rb
|
62
|
-
- lib/akshar/version.rb
|
63
|
-
- pkg/akshar-0.0.1.gem
|
64
|
-
- spec/akshar_spec.rb
|
65
|
-
- spec/spec_helper.rb
|
20
|
+
files: []
|
66
21
|
homepage: https://github.com/anupbrt/akshar
|
67
22
|
licenses:
|
68
23
|
- MIT
|
@@ -83,10 +38,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
38
|
version: '0'
|
84
39
|
requirements: []
|
85
40
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.4.
|
41
|
+
rubygems_version: 2.4.6
|
87
42
|
signing_key:
|
88
43
|
specification_version: 4
|
89
44
|
summary: Change Numbers to Nepali Names .i.e aanka to akshar ( अंक टु अक्षर )
|
90
|
-
test_files:
|
91
|
-
- spec/akshar_spec.rb
|
92
|
-
- spec/spec_helper.rb
|
45
|
+
test_files: []
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
-
|
5
|
-
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
-
|
7
|
-
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
-
|
9
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
-
|
11
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
-
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2015 anupbrt
|
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.
|
22
|
-
|
data/README.md
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# Akshar
|
2
|
-
|
3
|
-
Convert Numbers to Nepali Words( actually...Nepali words for Money ).
|
4
|
-
|
5
|
-
e.g.
|
6
|
-
|
7
|
-
1.to_akshar # "रुपैयाँ एक मात्र ।"
|
8
|
-
|
9
|
-
100.to_akshar # "रुपैयाँ एक सय मात्र ।"
|
10
|
-
|
11
|
-
101.34.to_akshar # रुपैयाँ एक सय एक, पैसा चौँतिस मात्र ।
|
12
|
-
|
13
|
-
1231232131231.to_akshar # "रुपैयाँ बाह्र खर्ब एकत्तिस अर्ब तेईस करोड एक्काइस लाख एकत्तिस हजार दुई सय एकत्तिस मात्र ।"
|
14
|
-
|
15
|
-
|
16
|
-
## Installation
|
17
|
-
|
18
|
-
Add this line to your application's Gemfile:
|
19
|
-
|
20
|
-
```ruby
|
21
|
-
gem 'akshar'
|
22
|
-
```
|
23
|
-
|
24
|
-
And then execute:
|
25
|
-
|
26
|
-
$ bundle
|
27
|
-
|
28
|
-
Or install it yourself as:
|
29
|
-
|
30
|
-
$ gem install akshar
|
31
|
-
|
32
|
-
|
33
|
-
## License
|
34
|
-
Copyright (c) 2015 Anup Neupane
|
35
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
36
|
-
|
37
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
38
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
39
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
40
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
41
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
42
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
43
|
-
THE SOFTWARE.
|
44
|
-
|
data/Rakefile
DELETED
data/akshar-0.0.1.gem
DELETED
Binary file
|
data/akshar.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'akshar/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "akshar"
|
8
|
-
spec.version = Akshar::VERSION
|
9
|
-
spec.authors = ["Anup Neupane"]
|
10
|
-
spec.email = ["anupbrt@outlook.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Change Numbers to Nepali Names .i.e aanka to akshar ( अंक टु अक्षर )}
|
13
|
-
spec.description = %q{This Gem will change Numbers to Nepali Names. example 100.akshar = "रुपैयाँ एक सय मात्र ।"}
|
14
|
-
spec.homepage = "https://github.com/anupbrt/akshar"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
#spec.add_dependency "activesupport"
|
20
|
-
|
21
|
-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
22
|
-
# delete this section to allow pushing this gem to any host.
|
23
|
-
|
24
|
-
spec.files = `git ls-files -z`.split("\x0")
|
25
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
26
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
27
|
-
spec.require_paths = ["lib"]
|
28
|
-
|
29
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
30
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
-
|
32
|
-
end
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "akshar"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/lib/akshar/version.rb
DELETED
data/lib/akshar.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
require "akshar/version"
|
2
|
-
|
3
|
-
module ToAkshar
|
4
|
-
|
5
|
-
SMALL_NUMBERS = {""=>"", 0=>"शुन्य", 1=>"एक", 2=>"दुई", 3=>"तीन", 4=>"चार", 5=>"पाँच", 6=>"छ", 7=>"सात", 8=>"आठ", 9=>"नौ", 10=>"दश", 11=>"एघार", 12=>"बाह्र", 13=>"तेह्र", 14=>"चौध", 15=>"पन्ध्र", 16=>"सोह्र", 17=>"सत्र", 18=>"अठार", 19=>"उन्नाइस", 20=>"विस", 21=>"एक्काइस", 22=>"बाइस", 23=>"तेईस", 24=>"चौविस", 25=>"पच्चिस", 26=>"छब्बिस", 27=>"सत्ताईस", 28=>"अठ्ठाईस", 29=>"उनन्तिस", 30=>"तिस", 31=>"एकत्तिस", 32=>"बत्तिस", 33=>"तेत्तिस", 34=>"चौँतिस", 35=>"पैँतिस", 36=>" छ्त्तीस", 37=>"सैंतीस", 38=>"अठतीस", 39=>"उनन्चालीस", 40=>"चालीस", 41=>"एकचालीस", 42=>"बयालीस", 43=>"त्रियालीस", 44=>"चवालीस", 45=>"पैँतालीस", 46=>"छयालीस", 47=>"सच्चालीस", 48=>"अठचालीस", 49=>"उनन्चास", 50=>"पचास", 51=>"एकाउन्न", 52=>"बाउन्न", 53=>"त्रिपन्न", 54=>"चउन्न", 55=>"पचपन्न", 56=>"छपन्न", 57=>"सन्ताउन्न", 58=>"अन्ठाउन्न", 59=>"उनन्साठी", 60=>"साठी", 61=>"एकसट्ठी", 62=>"बयसट्ठी", 63=>"त्रिसट्ठी", 64=>"चौंसट्ठी", 65=>"पैंसट्ठी", 66=>"छयसट्ठी", 67=>"सतसट्ठी", 68=>"अठसट्ठी", 69=>"उनन्सत्तरी", 70=>"सत्तरी", 71=>"एकहत्तर", 72=>"बहत्तर", 73=>"त्रिहत्तर", 74=>"चौहत्तर", 75=>"पचहत्तर", 76=>"छयहत्तर", 77=>"सतहत्तर", 78=>"अठहत्तर", 79=>"उनासी", 80=>"असी", 81=>"एकासी", 82=>"बयासी", 83=>"त्रियासी", 84=>"चौरासी", 85=>"पचासी", 86=>"छयासी", 87=>"सतासी", 88=>"अठासी", 89=>"उनान्नब्बे", 90=>"नब्बे", 91=>"एकान्नब्बे", 92=>"बयानब्बे", 93=>"त्रियान्नब्बे", 94=>"चौरान्नब्बे", 95=>"पन्चानब्बे", 96=>"छयान्नब्बे", 97=>"सन्तान्नब्बे", 98=>"अन्ठान्नब्बे", 99=>"उनान्सय", 100=>"एक सय"}
|
6
|
-
DIVISIONS = ["","हजार"]
|
7
|
-
|
8
|
-
|
9
|
-
def to_akshar
|
10
|
-
#return "रुपैयाँ " + self.to_nepali + " मात्र । "
|
11
|
-
if (self.to_nepali == false )
|
12
|
-
result = "Impossible Number | Check your Input"
|
13
|
-
else
|
14
|
-
result = "रुपैयाँ " + self.to_nepali + " मात्र ।"
|
15
|
-
end
|
16
|
-
|
17
|
-
return result.gsub(", पैसा शुन्य", '')
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_nepali
|
22
|
-
|
23
|
-
|
24
|
-
string = self.to_s.gsub(/\s+/, "")
|
25
|
-
|
26
|
-
decimalcheck = string.index('.')
|
27
|
-
if (decimalcheck != nil )
|
28
|
-
#return "Decimal Number Detected" + decimalcheck.to_s
|
29
|
-
paisa = string[decimalcheck+1 .. decimalcheck+2 ]
|
30
|
-
else
|
31
|
-
paisa = "0"
|
32
|
-
end
|
33
|
-
num = self.to_i
|
34
|
-
num, sign = check_sign(num)
|
35
|
-
return (sign + SMALL_NUMBERS[num]) if num <= 100
|
36
|
-
counter = 0
|
37
|
-
result = []
|
38
|
-
while num != 0
|
39
|
-
if (num > 10000000000000000)
|
40
|
-
return false
|
41
|
-
elsif ((num / 1000000000000000) >= 1)
|
42
|
-
test , remaining = num.divmod(1000000000000000)
|
43
|
-
return ((sign + SMALL_NUMBERS[test]) +" पद्म "+ (remaining.to_s+ "."+ paisa).to_nepali )
|
44
|
-
elsif ((num / 10000000000000) >= 1)
|
45
|
-
test , remaining = num.divmod(10000000000000)
|
46
|
-
return ((sign + SMALL_NUMBERS[test]) +" नील "+ (remaining.to_s+"."+paisa).to_nepali )
|
47
|
-
elsif ((num / 100000000000) >= 1)
|
48
|
-
test , remaining = num.divmod(100000000000)
|
49
|
-
return ((sign + SMALL_NUMBERS[test]) +" खर्ब "+ (remaining.to_s+"."+paisa).to_nepali )
|
50
|
-
elsif ((num / 1000000000) >= 1)
|
51
|
-
test , remaining = num.divmod(1000000000)
|
52
|
-
return ((sign + SMALL_NUMBERS[test]) +" अर्ब "+ (remaining.to_s+"."+paisa).to_nepali )
|
53
|
-
elsif ((num / 10000000) >= 1)
|
54
|
-
test , remaining = num.divmod(10000000)
|
55
|
-
return ((sign + SMALL_NUMBERS[test]) +" करोड "+ (remaining.to_s+"."+paisa).to_nepali )
|
56
|
-
elsif ((num / 100000) >= 1)
|
57
|
-
test , remaining = num.divmod(100000)
|
58
|
-
return ((sign + SMALL_NUMBERS[test]) +" लाख "+ (remaining.to_s+"."+paisa).to_nepali )
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
num, remaining = num.divmod(1000)
|
63
|
-
|
64
|
-
temp_result = result_below_one_thousand(remaining, counter)
|
65
|
-
result << temp_result + " " + DIVISIONS[counter] + "" if temp_result != ''
|
66
|
-
counter += 1
|
67
|
-
end
|
68
|
-
return sign + result.reverse.join(" ").rstrip + ", पैसा " + paisa.to_i.to_nepali
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
def result_below_one_thousand(num, counter)
|
74
|
-
hundred, remaining = num.divmod(100)
|
75
|
-
#return SMALL_NUMBERS[hundred] + " सय " + SMALL_NUMBERS[remaining] if hundred != 0 && remaining != 0 && counter != 0
|
76
|
-
return SMALL_NUMBERS[hundred] + " सय " + SMALL_NUMBERS[remaining] if hundred != 0 && remaining != 0
|
77
|
-
return SMALL_NUMBERS[remaining] if hundred == 0 && remaining != 0
|
78
|
-
return SMALL_NUMBERS[hundred] + " सय " if hundred != 0 && remaining == 0
|
79
|
-
return ''
|
80
|
-
end
|
81
|
-
|
82
|
-
def check_sign(num)
|
83
|
-
return num < 0 ? ([num.abs, 'ॠणात्मक ']) : ([num, ''])
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
|
89
|
-
class Fixnum
|
90
|
-
include ToAkshar
|
91
|
-
end
|
92
|
-
|
93
|
-
class Float
|
94
|
-
include ToAkshar
|
95
|
-
end
|
96
|
-
|
97
|
-
class String
|
98
|
-
include ToAkshar
|
99
|
-
end
|
100
|
-
|
101
|
-
class Bignum
|
102
|
-
include ToAkshar
|
103
|
-
end
|
data/pkg/akshar-0.0.1.gem
DELETED
Binary file
|
data/spec/akshar_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED