acts_as_decimal 1.1.0 → 1.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.
- data/Gemfile.lock +7 -7
- data/{README.rdoc → Readme.md} +17 -7
- data/acts_as_decimal.gemspec +5 -5
- data/lib/acts_as_decimal/version.rb +1 -1
- metadata +9 -9
data/Gemfile.lock
CHANGED
@@ -2,9 +2,9 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
acts_as_decimal (1.1.0)
|
5
|
-
actionpack (
|
6
|
-
activemodel (
|
7
|
-
activesupport (
|
5
|
+
actionpack (>= 3.0.0)
|
6
|
+
activemodel (>= 3.0.0)
|
7
|
+
activesupport (>= 3.0.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
@@ -38,8 +38,8 @@ GEM
|
|
38
38
|
erubis (2.6.6)
|
39
39
|
abstract (>= 1.0.0)
|
40
40
|
i18n (0.4.1)
|
41
|
-
rack (1.2.
|
42
|
-
rack-mount (0.6.
|
41
|
+
rack (1.2.3)
|
42
|
+
rack-mount (0.6.14)
|
43
43
|
rack (>= 1.0.0)
|
44
44
|
rack-test (0.5.7)
|
45
45
|
rack (>= 1.0)
|
@@ -62,10 +62,10 @@ PLATFORMS
|
|
62
62
|
ruby
|
63
63
|
|
64
64
|
DEPENDENCIES
|
65
|
-
activerecord (
|
65
|
+
activerecord (>= 3.0.0)
|
66
66
|
acts_as_decimal!
|
67
67
|
bluecloth
|
68
|
-
rspec (
|
68
|
+
rspec (>= 2.5.0)
|
69
69
|
simplecov
|
70
70
|
sqlite3
|
71
71
|
yard
|
data/{README.rdoc → Readme.md}
RENAMED
@@ -1,31 +1,39 @@
|
|
1
|
-
|
1
|
+
# acts_as_decimal
|
2
2
|
|
3
3
|
A simple gem for Rails 3 to make an attribute behave like it is floating point,
|
4
|
-
being stored as an integer in the database. Tested with Ruby 1.8, 1.9, Rubinius
|
4
|
+
being stored as an integer in the database. Tested with Ruby 1.8.7, 1.9.2, Rubinius 2.0.0pre and JRuby 1.6.2.
|
5
5
|
|
6
6
|
Add it to your Gemfile:
|
7
7
|
|
8
|
+
````ruby
|
8
9
|
gem 'acts_as_decimal'
|
10
|
+
````
|
9
11
|
|
10
|
-
And put this in your model, let's say a Product with a
|
12
|
+
And put this in your model, let's say a Product with a `#price` attribute:
|
11
13
|
|
14
|
+
````ruby
|
12
15
|
class Product < ActiveRecord::Base
|
13
16
|
acts_as_decimal :price # Defaults to 2 decimal floating point values, or...
|
14
17
|
acts_as_decimal :price, :decimals => 5 # ...as you wish!
|
15
18
|
end
|
19
|
+
````
|
16
20
|
|
17
|
-
Now you store and retrieve
|
21
|
+
Now you store and retrieve `#price` as a floating point:
|
18
22
|
|
23
|
+
````ruby
|
19
24
|
product = Product.new
|
20
25
|
product.price = 12.30
|
21
26
|
product.price # => 12.30
|
27
|
+
````
|
22
28
|
|
23
|
-
But you still have access to the raw database integer value through
|
29
|
+
But you still have access to the raw database integer value through `#price_raw`:
|
24
30
|
|
31
|
+
````ruby
|
25
32
|
product.price_raw # => 1230
|
26
33
|
product.price_raw = 4309 # product.price == 43.09
|
34
|
+
````
|
27
35
|
|
28
|
-
|
36
|
+
## Note on Patches/Pull Requests
|
29
37
|
|
30
38
|
* Fork the project.
|
31
39
|
* Make your feature addition or bug fix.
|
@@ -33,6 +41,8 @@ But you still have access to the raw database integer value through :price_raw:
|
|
33
41
|
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
34
42
|
* Send me a pull request. Bonus points for topic branches.
|
35
43
|
|
36
|
-
|
44
|
+
## Copyright
|
37
45
|
|
38
46
|
Copyright (c) 2010 Codegram. See LICENSE for details.
|
47
|
+
|
48
|
+
|
data/acts_as_decimal.gemspec
CHANGED
@@ -12,12 +12,12 @@ Gem::Specification.new do |s|
|
|
12
12
|
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).}
|
13
13
|
s.rubyforge_project = 'acts_as_decimal'
|
14
14
|
|
15
|
-
s.add_runtime_dependency 'activemodel', '
|
16
|
-
s.add_runtime_dependency 'activesupport', '
|
17
|
-
s.add_runtime_dependency 'actionpack', '
|
15
|
+
s.add_runtime_dependency 'activemodel', '>= 3.0.0'
|
16
|
+
s.add_runtime_dependency 'activesupport', '>= 3.0.0'
|
17
|
+
s.add_runtime_dependency 'actionpack', '>= 3.0.0'
|
18
18
|
|
19
|
-
s.add_development_dependency 'rspec', '
|
20
|
-
s.add_development_dependency 'activerecord', '
|
19
|
+
s.add_development_dependency 'rspec', '>= 2.5.0'
|
20
|
+
s.add_development_dependency 'activerecord', '>= 3.0.0'
|
21
21
|
s.add_development_dependency 'sqlite3'
|
22
22
|
|
23
23
|
s.add_development_dependency 'simplecov'
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: acts_as_decimal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Oriol Gual
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-
|
15
|
+
date: 2011-06-22 00:00:00 +02:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
22
22
|
none: false
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
27
|
type: :runtime
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirement: &id002 !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 3.0.0
|
38
38
|
type: :runtime
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirement: &id003 !ruby/object:Gem::Requirement
|
44
44
|
none: false
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 3.0.0
|
49
49
|
type: :runtime
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
requirement: &id004 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 2.5.0
|
60
60
|
type: :development
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
requirement: &id005 !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: 3.0.0
|
71
71
|
type: :development
|
@@ -131,8 +131,8 @@ files:
|
|
131
131
|
- Gemfile
|
132
132
|
- Gemfile.lock
|
133
133
|
- LICENSE
|
134
|
-
- README.rdoc
|
135
134
|
- Rakefile
|
135
|
+
- Readme.md
|
136
136
|
- acts_as_decimal.gemspec
|
137
137
|
- lib/acts_as_decimal.rb
|
138
138
|
- lib/acts_as_decimal/acts_as_decimal.rb
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
requirements: []
|
165
165
|
|
166
166
|
rubyforge_project: acts_as_decimal
|
167
|
-
rubygems_version: 1.
|
167
|
+
rubygems_version: 1.6.1
|
168
168
|
signing_key:
|
169
169
|
specification_version: 3
|
170
170
|
summary: Treat an attribute as if it were a decimal, storing it as an integer in the database.
|