paisa 0.1.0 → 0.1.1

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: b172c1486112f4bbb82fc7eaad14c6032616e39c
4
- data.tar.gz: 4f57f4696a1181bed2799be40e018caf37739808
3
+ metadata.gz: eaa38290ac4afc7ee38d0ff32429018ab16dadd3
4
+ data.tar.gz: f7de502cf23909a04c0fd2f300c6accbf8ece1d2
5
5
  SHA512:
6
- metadata.gz: 99705cd3bf796d1abdb74338ec92d44ed399a5e165f3a7484da462e64a4980f8698f361fad78c4beeb182e19ea18602458584600d7ac28f94a4a9f548502e183
7
- data.tar.gz: a78c1c35f4a61c91773d398ee0a062fe546b2eb2af599a806d1818bf1142fb800542a75a44e0f1db05863cd96ed742f01cd7c5da67e86f8e8c7020aaa9fe339a
6
+ metadata.gz: fb1f3234a4f4aff3a95bbfbfd07625b629c52abc0a9d298d77c9418e9d2889c42f2e71be9b7d016e76b9b4c72634cfb6c16ced191d02c600a77aeaf3dcb5c637
7
+ data.tar.gz: 4e078ec975010ba8e03ebb82d942cd786861b06d13bd3b6fae884eac264f1d82aee7bf269ffbe307e3233f6aa6589a2fa52323198b71b23ba7ccbc78abeece32
data/.gitignore CHANGED
@@ -7,3 +7,5 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
11
+ /test/reports
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Paisa
1
+ # Paisa [![CircleCI](https://circleci.com/gh/sudhirj/paisa.svg?style=svg)](https://circleci.com/gh/sudhirj/paisa)
2
2
 
3
3
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/paisa`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
data/lib/paisa.rb CHANGED
@@ -2,12 +2,12 @@ require 'paisa/version'
2
2
 
3
3
  module Paisa
4
4
  def self.format(paise)
5
- base_string = paise.to_s
6
- formatted_string = paise.to_s.rjust(3, '0').insert(-3, '.')
7
- formatted_string = formatted_string.insert(-7, ',') if base_string.size > 5
8
- formatted_string = formatted_string.insert(-10, ',') if base_string.size > 7
9
- formatted_string = formatted_string.insert(-13, ',') if base_string.size > 9
10
- formatted_string
5
+ little_endian = paise.to_s.reverse.chars
6
+ paise = little_endian.shift(2).reverse
7
+ hundreds = little_endian.shift(3).reverse
8
+ others = little_endian.each_slice(2).map(&:reverse).map(&:join)
9
+ rupees = [others.reverse, hundreds.join].flatten.compact.join(',').rjust(1, '0')
10
+ [rupees, paise.join.rjust(2, '0')].join('.')
11
11
  end
12
12
 
13
13
  def self.format_with_sym(paise)
data/lib/paisa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Paisa
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'.freeze
3
3
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sudhir Jonathan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-31 00:00:00.000000000 Z
11
+ date: 2016-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler