symbolize 4.5.1 → 4.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/symbolize.rb +1 -1
- data/lib/symbolize/active_record.rb +4 -6
- data/lib/symbolize/mongoid.rb +4 -4
- data/lib/symbolize/version.rb +1 -1
- data/spec/spec_helper.rb +0 -10
- data/spec/symbolize/active_record_spec.rb +3 -0
- data/spec/symbolize/mongoid_spec.rb +0 -2
- metadata +62 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5e77f572a11785b5d3238555722c84519b4e2af
|
4
|
+
data.tar.gz: 3a7cdff3f727e1b6266175ee08c3e2d267c052e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adec43662d908ca956639c34dbd1e1424636d0afa3506e6d4c4bc4da6cfef6ec0ef30db2efccc5204d672f5a9c6ba4422c7520af1b606a377c303ca091eba7d5
|
7
|
+
data.tar.gz: ef3911c3a16d2b64a3782aca0b85de074acbe1542184887fd4e79d3b94015ab7ae2b1f7680652fcfd68c393b2e8967e35656e91cf2faaf089132c3b5bcc1ff9c
|
data/lib/symbolize.rb
CHANGED
@@ -75,12 +75,10 @@ module Symbolize
|
|
75
75
|
if enum.is_a?(Hash)
|
76
76
|
enum
|
77
77
|
else
|
78
|
-
enum.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
]
|
83
|
-
end.to_h
|
78
|
+
enum.each_with_object({}) do |e, a|
|
79
|
+
a.store(e.respond_to?(:to_sym) ? e.to_sym : e,
|
80
|
+
capitalize ? e.to_s.capitalize : e.to_s)
|
81
|
+
end
|
84
82
|
end
|
85
83
|
|
86
84
|
values_name = attr_name_str + '_values'
|
data/lib/symbolize/mongoid.rb
CHANGED
@@ -50,7 +50,7 @@ module Mongoid
|
|
50
50
|
# Specifies that values of the given attributes should be returned
|
51
51
|
# as symbols. The table column should be created of type string.
|
52
52
|
|
53
|
-
def symbolize(*attr_names)
|
53
|
+
def symbolize(*attr_names) # rubocop:disable Metrics/AbcSize
|
54
54
|
configuration = attr_names.extract_options!
|
55
55
|
configuration.assert_valid_keys(:in, :within, :i18n, :scopes, :methods, :capitalize, :validate, :default, :allow_blank, :allow_nil, :type)
|
56
56
|
|
@@ -74,9 +74,9 @@ module Mongoid
|
|
74
74
|
if enum.is_a?(Hash)
|
75
75
|
enum
|
76
76
|
else
|
77
|
-
enum.each_with_object({}) do |
|
78
|
-
|
79
|
-
capitalize ?
|
77
|
+
enum.each_with_object({}) do |e, a|
|
78
|
+
a.store(e.respond_to?(:to_sym) ? e.to_sym : e,
|
79
|
+
capitalize ? e.to_s.capitalize : e.to_s)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
data/lib/symbolize/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -61,14 +61,4 @@ unless ENV['ONLY_MONGOID']
|
|
61
61
|
CreateTestingStructure.migrate(:up)
|
62
62
|
end
|
63
63
|
|
64
|
-
# Spec::Runner.configure do |config|
|
65
|
-
# end
|
66
|
-
|
67
|
-
RSpec.configure do |config|
|
68
|
-
|
69
|
-
config.after(:each) do
|
70
|
-
[User, Permission].each(&:delete_all)
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
64
|
end
|
@@ -7,7 +7,6 @@ class Person
|
|
7
7
|
include Mongoid::Document
|
8
8
|
include Mongoid::Symbolize
|
9
9
|
include Mongoid::Timestamps
|
10
|
-
include Mongoid::Attributes::Dynamic
|
11
10
|
|
12
11
|
symbolize :other, :i18n => false
|
13
12
|
|
@@ -50,7 +49,6 @@ end
|
|
50
49
|
class Right
|
51
50
|
include Mongoid::Document
|
52
51
|
include Mongoid::Symbolize
|
53
|
-
include Mongoid::Attributes::Dynamic
|
54
52
|
|
55
53
|
validates :name, :presence => true
|
56
54
|
symbolize :kind, :in => [:temp, :perm], :default => :perm
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symbolize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: i18n
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: activemodel
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -51,7 +65,7 @@ dependencies:
|
|
51
65
|
- !ruby/object:Gem::Version
|
52
66
|
version: '5'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
68
|
+
name: pry
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
56
70
|
requirements:
|
57
71
|
- - ">="
|
@@ -65,7 +79,7 @@ dependencies:
|
|
65
79
|
- !ruby/object:Gem::Version
|
66
80
|
version: '0'
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
82
|
+
name: mongoid
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|
70
84
|
requirements:
|
71
85
|
- - ">="
|
@@ -79,7 +93,7 @@ dependencies:
|
|
79
93
|
- !ruby/object:Gem::Version
|
80
94
|
version: '0'
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
96
|
+
name: activerecord
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
84
98
|
requirements:
|
85
99
|
- - ">="
|
@@ -134,6 +148,48 @@ dependencies:
|
|
134
148
|
- - ">="
|
135
149
|
- !ruby/object:Gem::Version
|
136
150
|
version: '0'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: guard
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: guard-rspec
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: guard-rubocop
|
181
|
+
requirement: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
137
193
|
description: ActiveRecord/Mongoid enums with i18n
|
138
194
|
email: x@nofxx.com
|
139
195
|
executables: []
|
@@ -178,3 +234,4 @@ signing_key:
|
|
178
234
|
specification_version: 4
|
179
235
|
summary: Object enums with i18n in AR or Mongoid
|
180
236
|
test_files: []
|
237
|
+
has_rdoc:
|