sheng 0.6.0 → 0.7.0

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: 7c3fd415b575d840f656d108d59c7877453e4b21
4
- data.tar.gz: cdfe674b6cc940344dc11a98bc7cd6b049b477e3
3
+ metadata.gz: 0ec8f23105c305c72f5b53353159af9e06270a9d
4
+ data.tar.gz: fa8ab0fb420ce05a35bbd618cf3917ba2db37079
5
5
  SHA512:
6
- metadata.gz: 22bd647f4447af076046039d90c0b51ef5394e93b26032b960db3724b33566e93aafc6d4bf2f2eefc18185433d47980f85f187d578c7eda9befc9614367cdaca
7
- data.tar.gz: e63a965701379ab2e5c7082cc88b46909c3945580558adf446a7dbb3d6d43345e900688b5d1e914ebb8721f6105dfefb985bd35f5b3cbe0cf0b53fae9db1a8b4
6
+ metadata.gz: 2bf7eba12b6dafaa74b3f124af9c4a0067ac27881dbcfa1c9d53534f75743315de50a55f07254097447931d41a2e18ee6cab169d03fa07be5e2efcb2cc4f04f6
7
+ data.tar.gz: ead41846b76e31006b09f52d5d7e83379e6daaf6e6d68fade166849dc3d524326c8361295a0d60c3465200d54bdd11900aae07e32d98c49fa5ce8b216dc217f7
@@ -8,9 +8,19 @@ module Sheng
8
8
  def filter(value)
9
9
  return value unless Sheng::Support.is_numeric?(value)
10
10
  integer, fractional = ("%00.2f" % value).split(".")
11
- integer.reverse!.gsub!(/(\d{3})(?=\d)/, '\\1,').reverse!
11
+
12
+ if integer.length > 3
13
+ insert_commas(integer)
14
+ end
15
+
12
16
  "#{arguments.first}#{integer}.#{fractional}"
13
17
  end
18
+
19
+ private
20
+
21
+ def insert_commas(integer)
22
+ integer.reverse!.gsub!(/(\d{3})(?=\d)/, '\\1,').reverse!
23
+ end
14
24
  end
15
25
  end
16
- end
26
+ end
data/lib/sheng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sheng
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
data/sheng.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "sheng"
8
8
  spec.version = Sheng::VERSION
9
9
  spec.authors = ["Ravi Gadad", "Maher Hawash"]
10
- spec.email = ["ravi@renewfund.com"]
10
+ spec.email = ["ravi@renewfund.com", "hungryed6@gmail.com"]
11
11
  spec.description = "A Ruby gem for data merging Word documents."
12
12
  spec.summary = "A Ruby gem for data merging Word documents, using native MergeFields as placeholders in templates, and a Ruby hash as the data set for substitution."
13
13
  spec.homepage = ""
@@ -4,6 +4,7 @@ describe Sheng::Filters::CurrencyFormattingFilter do
4
4
  test_cases = [
5
5
  { method: :currency, input: 3452341.826, output: "3,452,341.83" },
6
6
  { method: :currency, input: "1645.3", output: "1,645.30" },
7
+ { method: :currency, input: 192.3, output: "192.30" },
7
8
  { method: :currency, arguments: ["¥"], input: "12351.184", output: "¥12,351.18" }
8
9
  ]
9
10
 
@@ -17,4 +18,4 @@ describe Sheng::Filters::CurrencyFormattingFilter do
17
18
  end
18
19
  end
19
20
  end
20
- end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sheng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ravi Gadad
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-02 00:00:00.000000000 Z
12
+ date: 2016-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -154,6 +154,7 @@ dependencies:
154
154
  description: A Ruby gem for data merging Word documents.
155
155
  email:
156
156
  - ravi@renewfund.com
157
+ - hungryed6@gmail.com
157
158
  executables: []
158
159
  extensions: []
159
160
  extra_rdoc_files: []