money_attribute 0.14.5 → 1.2.0
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.
- checksums.yaml +4 -4
- data/README.md +257 -105
- data/Rakefile +50 -6
- data/lib/generators/templates/money_attribute.rb +20 -12
- data/lib/money_attribute/attribute_spec.rb +78 -0
- data/lib/money_attribute/attribute_spec_registry.rb +50 -0
- data/lib/money_attribute/configuration.rb +44 -17
- data/lib/money_attribute/converter.rb +18 -6
- data/lib/money_attribute/core_ext/numeric.rb +8 -0
- data/lib/money_attribute/core_ext/string.rb +8 -0
- data/lib/money_attribute/current.rb +13 -0
- data/lib/money_attribute/form_builder_extension.rb +4 -1
- data/lib/money_attribute/macro.rb +50 -73
- data/lib/money_attribute/migration_extensions/helper.rb +52 -45
- data/lib/money_attribute/migration_extensions/schema_statements.rb +16 -3
- data/lib/money_attribute/migration_extensions/table_definition.rb +15 -2
- data/lib/money_attribute/money_amount.rb +33 -0
- data/lib/money_attribute/query/amount_condition.rb +48 -0
- data/lib/money_attribute/query/amount_order.rb +22 -0
- data/lib/money_attribute/query/currency_condition.rb +23 -0
- data/lib/money_attribute/query/helpers.rb +30 -0
- data/lib/money_attribute/query/pick.rb +38 -0
- data/lib/money_attribute/query/pluck.rb +43 -0
- data/lib/money_attribute/query/sum.rb +40 -0
- data/lib/money_attribute/query.rb +120 -0
- data/lib/money_attribute/railtie.rb +32 -16
- data/lib/money_attribute/type.rb +42 -36
- data/lib/money_attribute/version.rb +1 -1
- data/lib/money_attribute.rb +17 -1
- metadata +20 -7
- data/lib/money_attribute/core_ext.rb +0 -15
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: money_attribute
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gilson Ferraz
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: '2.0'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: '2.0'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rails
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 7.1
|
|
32
|
+
version: '7.1'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 7.1
|
|
39
|
+
version: '7.1'
|
|
40
40
|
description: Easily add money attributes to your Rails models
|
|
41
41
|
email:
|
|
42
42
|
- gilson@cesar.etc.br
|
|
@@ -50,14 +50,27 @@ files:
|
|
|
50
50
|
- lib/generators/money_attribute/initializer_generator.rb
|
|
51
51
|
- lib/generators/templates/money_attribute.rb
|
|
52
52
|
- lib/money_attribute.rb
|
|
53
|
+
- lib/money_attribute/attribute_spec.rb
|
|
54
|
+
- lib/money_attribute/attribute_spec_registry.rb
|
|
53
55
|
- lib/money_attribute/configuration.rb
|
|
54
56
|
- lib/money_attribute/converter.rb
|
|
55
|
-
- lib/money_attribute/core_ext.rb
|
|
57
|
+
- lib/money_attribute/core_ext/numeric.rb
|
|
58
|
+
- lib/money_attribute/core_ext/string.rb
|
|
59
|
+
- lib/money_attribute/current.rb
|
|
56
60
|
- lib/money_attribute/form_builder_extension.rb
|
|
57
61
|
- lib/money_attribute/macro.rb
|
|
58
62
|
- lib/money_attribute/migration_extensions/helper.rb
|
|
59
63
|
- lib/money_attribute/migration_extensions/schema_statements.rb
|
|
60
64
|
- lib/money_attribute/migration_extensions/table_definition.rb
|
|
65
|
+
- lib/money_attribute/money_amount.rb
|
|
66
|
+
- lib/money_attribute/query.rb
|
|
67
|
+
- lib/money_attribute/query/amount_condition.rb
|
|
68
|
+
- lib/money_attribute/query/amount_order.rb
|
|
69
|
+
- lib/money_attribute/query/currency_condition.rb
|
|
70
|
+
- lib/money_attribute/query/helpers.rb
|
|
71
|
+
- lib/money_attribute/query/pick.rb
|
|
72
|
+
- lib/money_attribute/query/pluck.rb
|
|
73
|
+
- lib/money_attribute/query/sum.rb
|
|
61
74
|
- lib/money_attribute/railtie.rb
|
|
62
75
|
- lib/money_attribute/type.rb
|
|
63
76
|
- lib/money_attribute/version.rb
|
|
@@ -86,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
86
99
|
- !ruby/object:Gem::Version
|
|
87
100
|
version: '0'
|
|
88
101
|
requirements: []
|
|
89
|
-
rubygems_version: 4.0.
|
|
102
|
+
rubygems_version: 4.0.17
|
|
90
103
|
specification_version: 4
|
|
91
104
|
summary: Money attributes for ActiveRecord
|
|
92
105
|
test_files: []
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# :nodoc
|
|
4
|
-
class Numeric
|
|
5
|
-
remove_method :to_money
|
|
6
|
-
|
|
7
|
-
def to_money(currency = MoneyAttribute.default_currency) = Mint.money(self, currency)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# :nodoc
|
|
11
|
-
class String
|
|
12
|
-
remove_method :to_money
|
|
13
|
-
|
|
14
|
-
def to_money(currency = MoneyAttribute.default_currency) = Mint.parse(self, currency)
|
|
15
|
-
end
|