power_enum 2.7.0 → 2.7.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.
- checksums.yaml +6 -14
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/power_enum/has_enumerated.rb +16 -3
- data/lib/power_enum/reflection.rb +1 -0
- metadata +46 -61
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NjlkMDFiZmM5MGQyZmRlYWI3YTM4NmViYmUxNTQ1ZGYzY2I3YmM5NDQ2YTNk
|
10
|
-
Y2Q5YzZlZDRhYTllMDQxNThlNjdkMjVlOWQ4YWEwMjY2NjBhMzQ4MTZmMzQw
|
11
|
-
YTlkM2RkMjY1ZDNlMGUxYTYxNzU1YTVhNTEwZmQ2YmYyNTVjMjk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YWQyZTk5YmEyZDJhMTJjYzY2NjYyZTM0YTMyYTUwNGIxNjYxYTlmNTJhYTAx
|
14
|
-
ZGI4MzBmMWQ4YTRlZWRiOGIwZjAzZmYwMzdmNTg2N2UxMjQ3Njc1ZWFiNzRm
|
15
|
-
YjU2NGE4ZDhlNGRjZWZmNzI2ZjJhYjNiOWM2MTE1OWNiYjM4Yjk=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7106c64cd85124483414f071a41693b1db42d7f
|
4
|
+
data.tar.gz: 7c47e87dc6bc4733972a84fc7236a9c32c002a8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b18dae6376623e5556ef9b79a5e3e237602efd74db5ad27de7e0caa9e00a7c14327e7a2d5b71c2b8c2c32f9d7adee96e531871f80d9b9b69b8bcf2cf5ebafebc
|
7
|
+
data.tar.gz: d3b3af4731a65de4f2b6d55ec95216fc60c753d2f42ac91ed632a50e962c7bd1c4b74172764624ad6a73207c80cf54b7e5755a91e90ecfacd5666dbaf1266c7c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -88,8 +88,7 @@ module PowerEnum::HasEnumerated
|
|
88
88
|
:create_scope )
|
89
89
|
|
90
90
|
# Add a reflection for the enumerated attribute.
|
91
|
-
reflection
|
92
|
-
self.reflections = self.reflections.merge(part_id => reflection)
|
91
|
+
reflection = create_ar_reflection(part_id, options)
|
93
92
|
|
94
93
|
attribute_name = part_id.to_s
|
95
94
|
class_name = reflection.class_name
|
@@ -122,6 +121,20 @@ module PowerEnum::HasEnumerated
|
|
122
121
|
|
123
122
|
end # has_enumerated
|
124
123
|
|
124
|
+
# Creates the ActiveRecord reflection
|
125
|
+
def create_ar_reflection(part_id, options)
|
126
|
+
reflection = PowerEnum::Reflection::EnumerationReflection.new(part_id, options, self)
|
127
|
+
|
128
|
+
# ActiveRecord 4.1.2 handles this differently.
|
129
|
+
if self.respond_to? :_reflections=
|
130
|
+
self._reflections = self._reflections.merge(part_id => reflection)
|
131
|
+
else
|
132
|
+
self.reflections = self.reflections.merge(part_id => reflection)
|
133
|
+
end
|
134
|
+
reflection
|
135
|
+
end
|
136
|
+
private :create_ar_reflection
|
137
|
+
|
125
138
|
# Defines the accessor method
|
126
139
|
def define_enum_accessor(attribute_name, class_name, foreign_key, failure_handler) #:nodoc:
|
127
140
|
module_eval( <<-end_eval, __FILE__, __LINE__ )
|
@@ -265,4 +278,4 @@ module PowerEnum::HasEnumerated
|
|
265
278
|
|
266
279
|
end #module MacroMethods
|
267
280
|
|
268
|
-
end #module PowerEnum::HasEnumerated
|
281
|
+
end #module PowerEnum::HasEnumerated
|
@@ -44,6 +44,7 @@ module PowerEnum::Reflection
|
|
44
44
|
# Reflection class for enum reflections. See ActiveRecord::Reflection
|
45
45
|
class EnumerationReflection < ActiveRecord::Reflection::MacroReflection
|
46
46
|
attr_reader :counter_cache_column
|
47
|
+
attr_accessor :parent_reflection
|
47
48
|
|
48
49
|
# See ActiveRecore::Reflection::MacroReflection
|
49
50
|
def initialize( name, options, active_record )
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Squires
|
@@ -11,134 +11,119 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain:
|
14
|
-
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
RkxzYXdHbkp0TEdWCllDdmdpc3k1UFJGWnM4L1hhc0x6Z1NQWFBac0RKWkxJ
|
38
|
-
WDl1M0R1TGZRR0pFYTN2dkFwSzdMdWRNOTljV2J1bWIKbElkZW1KSjFoWFBm
|
39
|
-
WFJ6Nk9WeXRHYWxwWEdxT3V1MHJtT0ltY1BzVCttUlplLzhaRmd0eFA5THEr
|
40
|
-
WmFvRDIvaApHZUFNV0Urb2pITjVZZjl5Y3g3NldpZy9oeHZHWjd5MWRVQTg5
|
41
|
-
L2xKOGNVV2ZuUytGU0lMVm5tSXJoUGZyRHF3CmluWG9GdW5CNzJFTDZvcHd1
|
42
|
-
a2M3Y0Q5cFVtc05zVjBIZEFTdENHNWpPaGM1VHhMMVpYaFg4UXFlMmlOb25n
|
43
|
-
PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
|
44
|
-
date: 2014-05-02 00:00:00.000000000 Z
|
14
|
+
- |
|
15
|
+
-----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+0P14FrzQVWuPZ5AYh7t1x1OLFpAGbsNIskUI1FLsawGnJtLGV
|
31
|
+
YCvgisy5PRFZs8/XasLzgSPXPZsDJZLIX9u3DuLfQGJEa3vvApK7LudM99cWbumb
|
32
|
+
lIdemJJ1hXPfXRz6OVytGalpXGqOuu0rmOImcPsT+mRZe/8ZFgtxP9Lq+ZaoD2/h
|
33
|
+
GeAMWE+ojHN5Yf9ycx76Wig/hxvGZ7y1dUA89/lJ8cUWfnS+FSILVnmIrhPfrDqw
|
34
|
+
inXoFunB72EL6opwukc7cD9pUmsNsV0HdAStCG5jOhc5TxL1ZXhX8Qqe2iNong==
|
35
|
+
-----END CERTIFICATE-----
|
36
|
+
date: 2014-06-28 00:00:00.000000000 Z
|
45
37
|
dependencies:
|
46
38
|
- !ruby/object:Gem::Dependency
|
47
39
|
name: rails
|
48
40
|
requirement: !ruby/object:Gem::Requirement
|
49
41
|
requirements:
|
50
|
-
- - ~>
|
42
|
+
- - "~>"
|
51
43
|
- !ruby/object:Gem::Version
|
52
44
|
version: '4.0'
|
53
45
|
type: :runtime
|
54
46
|
prerelease: false
|
55
47
|
version_requirements: !ruby/object:Gem::Requirement
|
56
48
|
requirements:
|
57
|
-
- - ~>
|
49
|
+
- - "~>"
|
58
50
|
- !ruby/object:Gem::Version
|
59
51
|
version: '4.0'
|
60
52
|
- !ruby/object:Gem::Dependency
|
61
53
|
name: jeweler
|
62
54
|
requirement: !ruby/object:Gem::Requirement
|
63
55
|
requirements:
|
64
|
-
- -
|
56
|
+
- - ">="
|
65
57
|
- !ruby/object:Gem::Version
|
66
58
|
version: '0'
|
67
59
|
type: :development
|
68
60
|
prerelease: false
|
69
61
|
version_requirements: !ruby/object:Gem::Requirement
|
70
62
|
requirements:
|
71
|
-
- -
|
63
|
+
- - ">="
|
72
64
|
- !ruby/object:Gem::Version
|
73
65
|
version: '0'
|
74
66
|
- !ruby/object:Gem::Dependency
|
75
67
|
name: yard
|
76
68
|
requirement: !ruby/object:Gem::Requirement
|
77
69
|
requirements:
|
78
|
-
- -
|
70
|
+
- - ">="
|
79
71
|
- !ruby/object:Gem::Version
|
80
72
|
version: '0'
|
81
73
|
type: :development
|
82
74
|
prerelease: false
|
83
75
|
version_requirements: !ruby/object:Gem::Requirement
|
84
76
|
requirements:
|
85
|
-
- -
|
77
|
+
- - ">="
|
86
78
|
- !ruby/object:Gem::Version
|
87
79
|
version: '0'
|
88
80
|
- !ruby/object:Gem::Dependency
|
89
81
|
name: rspec
|
90
82
|
requirement: !ruby/object:Gem::Requirement
|
91
83
|
requirements:
|
92
|
-
- -
|
84
|
+
- - ">="
|
93
85
|
- !ruby/object:Gem::Version
|
94
86
|
version: '0'
|
95
87
|
type: :development
|
96
88
|
prerelease: false
|
97
89
|
version_requirements: !ruby/object:Gem::Requirement
|
98
90
|
requirements:
|
99
|
-
- -
|
91
|
+
- - ">="
|
100
92
|
- !ruby/object:Gem::Version
|
101
93
|
version: '0'
|
102
94
|
- !ruby/object:Gem::Dependency
|
103
95
|
name: sqlite3
|
104
96
|
requirement: !ruby/object:Gem::Requirement
|
105
97
|
requirements:
|
106
|
-
- -
|
98
|
+
- - ">="
|
107
99
|
- !ruby/object:Gem::Version
|
108
100
|
version: '0'
|
109
101
|
type: :development
|
110
102
|
prerelease: false
|
111
103
|
version_requirements: !ruby/object:Gem::Requirement
|
112
104
|
requirements:
|
113
|
-
- -
|
105
|
+
- - ">="
|
114
106
|
- !ruby/object:Gem::Version
|
115
107
|
version: '0'
|
116
108
|
- !ruby/object:Gem::Dependency
|
117
109
|
name: genspec
|
118
110
|
requirement: !ruby/object:Gem::Requirement
|
119
111
|
requirements:
|
120
|
-
- -
|
112
|
+
- - ">="
|
121
113
|
- !ruby/object:Gem::Version
|
122
114
|
version: 0.2.8
|
123
115
|
type: :development
|
124
116
|
prerelease: false
|
125
117
|
version_requirements: !ruby/object:Gem::Requirement
|
126
118
|
requirements:
|
127
|
-
- -
|
119
|
+
- - ">="
|
128
120
|
- !ruby/object:Gem::Version
|
129
121
|
version: 0.2.8
|
130
|
-
description:
|
131
|
-
as though they were an enumeration of values.
|
132
|
-
|
133
|
-
It
|
134
|
-
|
135
|
-
|
136
|
-
It is particularly suitable for scenarios where your Rails application is not the
|
137
|
-
only user of the database, such as
|
138
|
-
|
139
|
-
when it''s used for analytics or reporting.
|
140
|
-
|
141
|
-
'
|
122
|
+
description: |
|
123
|
+
Power Enum allows you to treat instances of your ActiveRecord models as though they were an enumeration of values.
|
124
|
+
It allows you to cleanly solve many of the problems that the traditional Rails alternatives handle poorly if at all.
|
125
|
+
It is particularly suitable for scenarios where your Rails application is not the only user of the database, such as
|
126
|
+
when it's used for analytics or reporting.
|
142
127
|
email: arthur.shagall@gmail.com
|
143
128
|
executables: []
|
144
129
|
extensions: []
|
@@ -146,6 +131,8 @@ extra_rdoc_files:
|
|
146
131
|
- LICENSE
|
147
132
|
- README.markdown
|
148
133
|
files:
|
134
|
+
- LICENSE
|
135
|
+
- README.markdown
|
149
136
|
- lib/active_record/virtual_enumerations.rb
|
150
137
|
- lib/generators/enum/USAGE
|
151
138
|
- lib/generators/enum/enum_generator.rb
|
@@ -162,8 +149,6 @@ files:
|
|
162
149
|
- lib/power_enum/reflection.rb
|
163
150
|
- lib/power_enum/schema/schema_statements.rb
|
164
151
|
- lib/testing/rspec.rb
|
165
|
-
- LICENSE
|
166
|
-
- README.markdown
|
167
152
|
homepage: http://github.com/albertosaurus/power_enum_2
|
168
153
|
licenses:
|
169
154
|
- MIT
|
@@ -174,17 +159,17 @@ require_paths:
|
|
174
159
|
- lib
|
175
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
161
|
requirements:
|
177
|
-
- -
|
162
|
+
- - ">="
|
178
163
|
- !ruby/object:Gem::Version
|
179
164
|
version: '0'
|
180
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
166
|
requirements:
|
182
|
-
- -
|
167
|
+
- - ">="
|
183
168
|
- !ruby/object:Gem::Version
|
184
169
|
version: '0'
|
185
170
|
requirements: []
|
186
171
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.2.2
|
188
173
|
signing_key:
|
189
174
|
specification_version: 4
|
190
175
|
summary: Allows you to treat instances of your ActiveRecord models as though they
|
metadata.gz.sig
CHANGED
Binary file
|