paisa 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paisa.rb +4 -4
- data/lib/paisa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc752f25537cef88838ce041e8347cfd6e86bae3
|
4
|
+
data.tar.gz: 8b538f7c3086861411be83a19880f8e84caa4c11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53e6e6eeae0cbaa5a8528253269c9dbfc31a77d51b6e7df0864c5e80e45e69408e150bfd9de5027a35ef9ec4818bdadd712134e671181b1771f5518790566823
|
7
|
+
data.tar.gz: 3007bbe43dab87b1a923627c0a6b17f04ccf1842b7aaf9781218c5461ac4d614634f97af90a0f7082981c920c4915d9e96c97a7fd0956e6f510c740f0746693e
|
data/lib/paisa.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'paisa/version'
|
2
2
|
|
3
3
|
module Paisa
|
4
|
-
def self.format(paise)
|
4
|
+
def self.format(paise, precision: 2)
|
5
5
|
little_endian = paise.to_s.reverse.chars
|
6
6
|
paise = little_endian.shift(2).reverse
|
7
7
|
hundreds = little_endian.shift(3).reverse
|
8
8
|
others = little_endian.each_slice(2).map(&:reverse).map(&:join)
|
9
9
|
rupees = [others.reverse, hundreds.join].flatten.compact.join(',').rjust(1, '0')
|
10
|
-
[rupees, paise.join.rjust(2, '0')].join('.')
|
10
|
+
[rupees, paise.join.rjust(2, '0').slice(0, precision)].reject(&:empty?).join('.')
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.format_with_sym(paise)
|
14
|
-
[symbol, format(paise)].join
|
13
|
+
def self.format_with_sym(paise, precision: 2)
|
14
|
+
[symbol, format(paise, precision: precision)].join
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.symbol
|
data/lib/paisa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paisa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sudhir Jonathan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|