acts_as_money 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/acts_as_money.rb +5 -6
  2. metadata +48 -46
@@ -16,15 +16,14 @@ module ActsAsMoney #:nodoc:
16
16
 
17
17
  module ClassMethods
18
18
  def money(name, options = {})
19
+ mapping = [[(options[:cents] || :cents).to_s, 'cents']]
20
+ mapping << [(options[:currency] || :currency).to_s, 'currency_as_string'] if options[:currency] != false
19
21
  composed_of name, {
20
22
  :class_name => 'Money',
21
23
  :allow_nil => options[:allow_nil],
22
- :mapping => [
23
- [(options[:cents] || :cents).to_s, 'cents'],
24
- [(options[:currency] || :currency).to_s, 'currency_as_string']
25
- ],
26
- :constructor => lambda {|cents, currency| options[:allow_nil] && !cents ? nil : Money.new(cents || 0, currency || Money.default_currency)},
27
- :converter => lambda { |value|
24
+ :mapping => mapping,
25
+ :constructor => Proc.new {|cents, currency| options[:allow_nil] && !cents ? nil : Money.new(cents || 0, currency || Money.default_currency)},
26
+ :converter => Proc.new { |value|
28
27
  case value
29
28
  when Fixnum
30
29
  Money.new(value, Money.default_currency)
metadata CHANGED
@@ -1,79 +1,81 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: acts_as_money
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
4
5
  prerelease:
5
- version: 0.2.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
+ - Jordan Glasner
9
+ - Econsultancy
8
10
  - Tim Cowlishaw
11
+ - Ylan Segal
9
12
  autorequire:
10
13
  bindir: bin
11
14
  cert_chain: []
12
-
13
- date: 2011-02-28 00:00:00 +00:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
15
+ date: 2012-02-03 00:00:00.000000000Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
17
18
  name: money
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
19
+ requirement: &16728260 !ruby/object:Gem::Requirement
20
20
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
25
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: activerecord
29
26
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ version_requirements: *16728260
28
+ - !ruby/object:Gem::Dependency
29
+ name: activerecord
30
+ requirement: &16727680 !ruby/object:Gem::Requirement
31
31
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "0"
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
36
  type: :runtime
37
- version_requirements: *id002
37
+ prerelease: false
38
+ version_requirements: *16727680
38
39
  description:
39
40
  email: tim@timcowlishaw.co.uk
40
41
  executables: []
41
-
42
42
  extensions: []
43
-
44
- extra_rdoc_files:
43
+ extra_rdoc_files:
45
44
  - README
46
- files:
45
+ files:
47
46
  - README
48
47
  - lib/acts_as_money.rb
49
- has_rdoc: true
50
48
  homepage: http://github.com/timcowlishaw/acts_as_money
51
49
  licenses: []
52
-
53
50
  post_install_message:
54
- rdoc_options:
51
+ rdoc_options:
55
52
  - --main
56
53
  - README
57
- require_paths:
54
+ require_paths:
58
55
  - lib
59
- required_ruby_version: !ruby/object:Gem::Requirement
56
+ required_ruby_version: !ruby/object:Gem::Requirement
60
57
  none: false
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: "0"
65
- required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ segments:
63
+ - 0
64
+ hash: 3980188286906307662
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: "0"
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ segments:
72
+ - 0
73
+ hash: 3980188286906307662
71
74
  requirements: []
72
-
73
75
  rubyforge_project:
74
- rubygems_version: 1.5.2
76
+ rubygems_version: 1.8.10
75
77
  signing_key:
76
78
  specification_version: 3
77
- summary: A fairly trivial plugin allowing easy serialisation of Money values (from the money gem) as attributes on activerecord objects
79
+ summary: A fairly trivial plugin allowing easy serialisation of Money values (from
80
+ the money gem) as attributes on activerecord objects
78
81
  test_files: []
79
-