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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8c8248c8a57a1c3e3248a339ec6214fd6fe93ef
4
- data.tar.gz: 5a2a2faba8acc56b88545a583507a714ea03f495
3
+ metadata.gz: d5e77f572a11785b5d3238555722c84519b4e2af
4
+ data.tar.gz: 3a7cdff3f727e1b6266175ee08c3e2d267c052e8
5
5
  SHA512:
6
- metadata.gz: a6cbd772314ae69fc054ea373487d515f3f3fb6a7eea1144ceda2382c463c0797114a5df969ee7e7e79c48f3f050003b651c5f5a453c7aa096b0dddbb12508c7
7
- data.tar.gz: 7dea8dbec2121d3357c269bcfad8926db2b3309a5d40a670911a9bdb972fd86ad9e9bad1bc862dede94acffc156c4a62a04fc263eb285e60d87c5d12847c6e3e
6
+ metadata.gz: adec43662d908ca956639c34dbd1e1424636d0afa3506e6d4c4bc4da6cfef6ec0ef30db2efccc5204d672f5a9c6ba4422c7520af1b606a377c303ca091eba7d5
7
+ data.tar.gz: ef3911c3a16d2b64a3782aca0b85de074acbe1542184887fd4e79d3b94015ab7ae2b1f7680652fcfd68c393b2e8967e35656e91cf2faaf089132c3b5bcc1ff9c
@@ -1,6 +1,6 @@
1
1
  module Symbolize
2
2
  autoload :ActiveRecord, 'symbolize/active_record'
3
+ autoload :Mongoid, 'symbolize/mongoid'
3
4
  end
4
5
 
5
- require 'symbolize/mongoid' if defined? Mongoid
6
6
  require 'symbolize/railtie' if defined? Rails
@@ -75,12 +75,10 @@ module Symbolize
75
75
  if enum.is_a?(Hash)
76
76
  enum
77
77
  else
78
- enum.map do |val|
79
- [
80
- val.respond_to?(:to_sym) ? val.to_sym : val,
81
- capitalize ? val.to_s.capitalize : val.to_s,
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'
@@ -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 |val, hsh|
78
- hsh.store(val.respond_to?(:to_sym) ? val.to_sym : val,
79
- capitalize ? val.to_s.capitalize : val.to_s)
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
 
@@ -1,3 +1,3 @@
1
1
  module Symbolize
2
- VERSION = '4.5.1'
2
+ VERSION = '4.5.2'
3
3
  end
@@ -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
@@ -43,6 +43,9 @@ class PermissionSubclass < Permission
43
43
  end
44
44
 
45
45
  describe 'Symbolize' do
46
+ before do
47
+ [User, Permission].each(&:delete_all)
48
+ end
46
49
 
47
50
  it 'should respond to symbolize' do
48
51
  expect(ActiveRecord::Base).to respond_to :symbolize
@@ -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.1
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-23 00:00:00.000000000 Z
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: activerecord
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: coveralls
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: mongoid
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: