amount_formatter 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/amount_formatter.gemspec +3 -3
- data/lib/amount_formatter.rb +1 -1
- data/spec/amount_formatter_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTcwNGQxYzM5YmRhMTI5NzZjZmQ1OWM2NTRmZThkNzkyNDE1NmFmYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmY4NmE5Mzk4ZDRiY2M4YmZhYWQwMTllNTY1YmY1ZDk5ZDhjNzE4YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmY0NzBhMjQwNDgxYjdhMGNlZWJhM2MwMjQwYTNkMjhlMjk2Y2VkNGU3Mzhh
|
10
|
+
M2NjNGU0ZTJlYmQxNmEyNjc5ZDU0YmZkMzQzZTQ1MGY1ODY4YzM2YWQyZGNh
|
11
|
+
NmZjMmUyN2QxNGExM2IyOTEyM2EzZDQzYThjNjMzZTg5YjhjNjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2YzYWQzZTVjNDg3MDU0ZmUxZGU1MmYxOTE2YmFlNTdlMDVlMDMzYjUyNDdk
|
14
|
+
MzQ3N2ZmYWU5MThmYWMxOWY2YzJlZTFkMjQzN2U1NWExNTc2NGI0NmIxZmRk
|
15
|
+
NjM0ZDUxYThlMTVmNThhYWZjZGMzMzVlMmU3MjIwODcyMTM2OWE=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/amount_formatter.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: amount_formatter 0.0.
|
5
|
+
# stub: amount_formatter 0.0.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "amount_formatter"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Kasper Johansen"]
|
14
|
-
s.date = "2014-01-
|
14
|
+
s.date = "2014-01-28"
|
15
15
|
s.description = "Amount formatting for Ruby."
|
16
16
|
s.email = "k@spernj.org"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/amount_formatter.rb
CHANGED
@@ -5,7 +5,7 @@ class AmountFormatter
|
|
5
5
|
def self.format(number, args = {})
|
6
6
|
args = FORMAT_DEFAULT_ARGS.merge(args)
|
7
7
|
number = number.to_f unless number.is_a?(Float)
|
8
|
-
return sprintf("%.#{args[:precision].to_i}f", number).gsub(".", seperator) if number < 1 && number > -1
|
8
|
+
return sprintf("%.#{args[:precision].to_i}f", number).gsub(".", args[:seperator]) if number < 1 && number > -1
|
9
9
|
number = sprintf("%.#{args[:precision].to_i}f", number).split(".")
|
10
10
|
|
11
11
|
str = ""
|
@@ -4,5 +4,6 @@ describe AmountFormatter do
|
|
4
4
|
it "formats numbers" do
|
5
5
|
AmountFormatter.format(12345.12, :precision => 2, :seperator => ",", :delimiter => ".").should eq "12.345,12"
|
6
6
|
AmountFormatter.format(12345.12).should eq "12,345.12"
|
7
|
+
AmountFormatter.format(0.1).should eq "0.10"
|
7
8
|
end
|
8
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amount_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|