acts_as_decimal 1.0.1 → 1.0.2
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.
- data/VERSION +1 -1
- data/acts_as_decimal.gemspec +2 -2
- data/lib/acts_as_decimal/acts_as_decimal.rb +2 -0
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.2
|
data/acts_as_decimal.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{acts_as_decimal}
|
|
8
|
-
s.version = "1.0.
|
|
8
|
+
s.version = "1.0.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Oriol Gual", "Josep M\302\252 Bach", "Josep Jaume Rey"]
|
|
12
|
-
s.date = %q{2010-
|
|
12
|
+
s.date = %q{2010-07-14}
|
|
13
13
|
s.description = %q{Rails 3 gem to treat an attribute as a decimal (storing and retrieving floating-point values) but storing it as an integer in the database (useful for prices and other money attributes).}
|
|
14
14
|
s.email = %q{info@codegram.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -22,6 +22,8 @@ module ActsAsDecimal
|
|
|
22
22
|
(self[:#{field}].nil? ? nil : (BigDecimal.new(self[:#{field}].to_s) / BigDecimal('10').power(#{options[:decimals]})).to_f)
|
|
23
23
|
end
|
|
24
24
|
def humanized_#{field}(options = {:thousand_delimiters => true})
|
|
25
|
+
|
|
26
|
+
return nil if #{field}.blank?
|
|
25
27
|
|
|
26
28
|
a = #{field}.to_s.split('.')
|
|
27
29
|
b = a[1].ljust(2,'0')
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 1
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
version: 1.0.
|
|
8
|
+
- 2
|
|
9
|
+
version: 1.0.2
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Oriol Gual
|
|
@@ -16,7 +16,7 @@ autorequire:
|
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date: 2010-
|
|
19
|
+
date: 2010-07-14 00:00:00 +02:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|