acts_as_decimal 1.0.4 → 1.0.5
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/.rvmrc +1 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +22 -20
- data/VERSION +1 -1
- data/acts_as_decimal.gemspec +5 -4
- data/lib/acts_as_decimal/acts_as_decimal.rb +1 -2
- data/spec/spec_helper.rb +1 -2
- metadata +16 -4
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create use ruby-1.8.7@acts_as_decimal > /dev/null
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,36 +1,38 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.0.0
|
5
|
-
activesupport (= 3.0.0
|
4
|
+
activemodel (3.0.0)
|
5
|
+
activesupport (= 3.0.0)
|
6
6
|
builder (~> 2.1.2)
|
7
7
|
i18n (~> 0.4.1)
|
8
|
-
activerecord (3.0.0
|
9
|
-
activemodel (= 3.0.0
|
10
|
-
activesupport (= 3.0.0
|
11
|
-
arel (~> 0.
|
12
|
-
tzinfo (~> 0.3.
|
13
|
-
activesupport (3.0.0
|
14
|
-
arel (0.
|
15
|
-
activesupport (
|
8
|
+
activerecord (3.0.0)
|
9
|
+
activemodel (= 3.0.0)
|
10
|
+
activesupport (= 3.0.0)
|
11
|
+
arel (~> 1.0.0)
|
12
|
+
tzinfo (~> 0.3.23)
|
13
|
+
activesupport (3.0.0)
|
14
|
+
arel (1.0.1)
|
15
|
+
activesupport (~> 3.0.0)
|
16
16
|
builder (2.1.2)
|
17
17
|
diff-lcs (1.1.2)
|
18
18
|
i18n (0.4.1)
|
19
|
-
rspec (2.0.0.beta.
|
20
|
-
rspec-core (= 2.0.0.beta.
|
21
|
-
rspec-expectations (= 2.0.0.beta.
|
22
|
-
rspec-mocks (= 2.0.0.beta.
|
23
|
-
rspec-core (2.0.0.beta.
|
24
|
-
rspec-expectations (2.0.0.beta.
|
19
|
+
rspec (2.0.0.beta.22)
|
20
|
+
rspec-core (= 2.0.0.beta.22)
|
21
|
+
rspec-expectations (= 2.0.0.beta.22)
|
22
|
+
rspec-mocks (= 2.0.0.beta.22)
|
23
|
+
rspec-core (2.0.0.beta.22)
|
24
|
+
rspec-expectations (2.0.0.beta.22)
|
25
25
|
diff-lcs (>= 1.1.2)
|
26
|
-
rspec-mocks (2.0.0.beta.
|
26
|
+
rspec-mocks (2.0.0.beta.22)
|
27
|
+
rspec-core (= 2.0.0.beta.22)
|
28
|
+
rspec-expectations (= 2.0.0.beta.22)
|
27
29
|
sqlite3-ruby (1.3.1)
|
28
|
-
tzinfo (0.3.
|
30
|
+
tzinfo (0.3.23)
|
29
31
|
|
30
32
|
PLATFORMS
|
31
33
|
ruby
|
32
34
|
|
33
35
|
DEPENDENCIES
|
34
|
-
activerecord (
|
35
|
-
rspec (>= 2.0.0.beta.
|
36
|
+
activerecord (= 3.0.0)
|
37
|
+
rspec (>= 2.0.0.beta.22)
|
36
38
|
sqlite3-ruby
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
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.5"
|
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. Bach", "Josep Jaume Rey"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-15}
|
13
13
|
s.description = %q{Rails 3 gem to treat an attribute as a decimal (getting and setting floating-point values) but storing it as an integer in the database (useful for prices and other precision-needed attributes like money).}
|
14
14
|
s.email = %q{info@codegram.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
".document",
|
22
22
|
".gitignore",
|
23
23
|
".rspec",
|
24
|
+
".rvmrc",
|
24
25
|
"Gemfile",
|
25
26
|
"Gemfile.lock",
|
26
27
|
"LICENSE",
|
@@ -37,7 +38,7 @@ Gem::Specification.new do |s|
|
|
37
38
|
s.homepage = %q{http://github.com/codegram/acts_as_decimal}
|
38
39
|
s.rdoc_options = ["--charset=UTF-8"]
|
39
40
|
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.
|
41
|
+
s.rubygems_version = %q{1.3.7}
|
41
42
|
s.summary = %q{Treat an attribute as if it were a decimal, storing it as an integer in the database.}
|
42
43
|
s.test_files = [
|
43
44
|
"spec/acts_as_decimal_spec.rb",
|
@@ -49,7 +50,7 @@ Gem::Specification.new do |s|
|
|
49
50
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
51
|
s.specification_version = 3
|
51
52
|
|
52
|
-
if Gem::Version.new(Gem::
|
53
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
54
|
s.add_runtime_dependency(%q<activemodel>, [">= 3.0.0.rc"])
|
54
55
|
s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
|
55
56
|
s.add_development_dependency(%q<activerecord>, [">= 3.0.0.rc"])
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
2
|
module ActsAsDecimal
|
3
3
|
require 'bigdecimal'
|
4
4
|
|
@@ -19,7 +19,6 @@ module ActsAsDecimal
|
|
19
19
|
fields.each do |field|
|
20
20
|
class_eval <<-EOC
|
21
21
|
def #{field}
|
22
|
-
# DOES NOT WORK PROPERLY WITH VIM (WTF¿?): (self[:#{field}].nil? ? nil : (BigDecimal.new(self[:#{field}].to_s) / BigDecimal('10').power(#{options[:decimals]})).to_f)
|
23
22
|
(self[:#{field}].nil? ? nil : (self[:#{field}] / BigDecimal('10').power(#{options[:decimals]}).to_f))
|
24
23
|
end
|
25
24
|
def human_#{field}(options = {:thousand_delimiters => true})
|
data/spec/spec_helper.rb
CHANGED
@@ -6,10 +6,9 @@ require 'active_record'
|
|
6
6
|
|
7
7
|
require 'acts_as_decimal'
|
8
8
|
require 'rspec'
|
9
|
-
require 'rspec/autorun'
|
10
9
|
|
11
10
|
RAILS_ENV = "test"
|
12
|
-
RAILS_VERSION = ENV['RAILS_VERSION'] || '3.0.0
|
11
|
+
RAILS_VERSION = ENV['RAILS_VERSION'] || '3.0.0'
|
13
12
|
|
14
13
|
ActiveRecord::Base.establish_connection(
|
15
14
|
:adapter => 'sqlite3',
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_decimal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 5
|
10
|
+
version: 1.0.5
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Oriol Gual
|
@@ -16,16 +17,18 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2010-
|
20
|
+
date: 2010-09-15 00:00:00 +02:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
23
24
|
name: activemodel
|
24
25
|
prerelease: false
|
25
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
26
28
|
requirements:
|
27
29
|
- - ">="
|
28
30
|
- !ruby/object:Gem::Version
|
31
|
+
hash: 7712042
|
29
32
|
segments:
|
30
33
|
- 3
|
31
34
|
- 0
|
@@ -38,9 +41,11 @@ dependencies:
|
|
38
41
|
name: rspec
|
39
42
|
prerelease: false
|
40
43
|
requirement: &id002 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
41
45
|
requirements:
|
42
46
|
- - ">="
|
43
47
|
- !ruby/object:Gem::Version
|
48
|
+
hash: 62196421
|
44
49
|
segments:
|
45
50
|
- 2
|
46
51
|
- 0
|
@@ -54,9 +59,11 @@ dependencies:
|
|
54
59
|
name: activerecord
|
55
60
|
prerelease: false
|
56
61
|
requirement: &id003 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
57
63
|
requirements:
|
58
64
|
- - ">="
|
59
65
|
- !ruby/object:Gem::Version
|
66
|
+
hash: 7712042
|
60
67
|
segments:
|
61
68
|
- 3
|
62
69
|
- 0
|
@@ -79,6 +86,7 @@ files:
|
|
79
86
|
- .document
|
80
87
|
- .gitignore
|
81
88
|
- .rspec
|
89
|
+
- .rvmrc
|
82
90
|
- Gemfile
|
83
91
|
- Gemfile.lock
|
84
92
|
- LICENSE
|
@@ -101,23 +109,27 @@ rdoc_options:
|
|
101
109
|
require_paths:
|
102
110
|
- lib
|
103
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
104
113
|
requirements:
|
105
114
|
- - ">="
|
106
115
|
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
107
117
|
segments:
|
108
118
|
- 0
|
109
119
|
version: "0"
|
110
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
111
122
|
requirements:
|
112
123
|
- - ">="
|
113
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
114
126
|
segments:
|
115
127
|
- 0
|
116
128
|
version: "0"
|
117
129
|
requirements: []
|
118
130
|
|
119
131
|
rubyforge_project:
|
120
|
-
rubygems_version: 1.3.
|
132
|
+
rubygems_version: 1.3.7
|
121
133
|
signing_key:
|
122
134
|
specification_version: 3
|
123
135
|
summary: Treat an attribute as if it were a decimal, storing it as an integer in the database.
|