mongoid-dsl 1.0.5 → 1.1.0

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: f39e270dbec92926dffe278614230fcc9e404bba
4
- data.tar.gz: e5239ffcf0fb792376df65b1339a2627d26569f3
3
+ metadata.gz: 07cba5496b2f12f68d75578a881013f36b133288
4
+ data.tar.gz: 478b9e6aea688f647d828e4c165f79c6d2fba26b
5
5
  SHA512:
6
- metadata.gz: 13aa7bc9b3a32a975714372d7cc5c9bb55ce83525f13723a81afe5260fb5c530317e4596b79279241018137131362ad5a832494e15f4df60b4130c1983653589
7
- data.tar.gz: 97449c93b223e46603958d97353c8b54bd749972692b3f6d1e50f348d506c875e73e907d0a14b2505101bda0d5a767c68f1b2c9c297909eda44fae0c362243f5
6
+ metadata.gz: 61812e613671a67fd4c76bfb4e8d00194782f230b374828859bc53f8357d034f695b71c13dc03b60710e9a7ca8de2d6cfb8823a6ce0227a093a05010b3c028b5
7
+ data.tar.gz: f791fc0ff404285a5b5a1e372119f6b3bbba55666170ff4d47c8dfd1de99485b4eea0da53e6c22d7de633f111197e45daf4814d017ecdf2ea425a2ee1ea4f399
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.1.0
@@ -181,3 +181,30 @@ end
181
181
 
182
182
  end
183
183
  end
184
+
185
+ [:hidden,:hide].each do |name_to_use|
186
+ Mongoid::Fields.option name_to_use do |model, field, value|
187
+
188
+ field.instance_variable_get('@options')[:hidden]= field.instance_variable_get('@options').delete(name_to_use)
189
+
190
+ model.instance_eval do
191
+
192
+ begin
193
+ self.class_variable_get(:@@mongoid_dsl_hidden_fields)
194
+ rescue NameError
195
+
196
+ self.class_variable_set :@@mongoid_dsl_hidden_fields, []
197
+ [:hidden,:hide].each { |sym| scope sym, -> { without(*self.class_variable_get(:@@mongoid_dsl_hidden_fields)) } }
198
+
199
+ unless default_scoping?
200
+ default_scope -> { hidden }
201
+ end
202
+
203
+ end
204
+
205
+ self.class_variable_get(:@@mongoid_dsl_hidden_fields).push(field.instance_variable_get(:@name)) if !!value
206
+
207
+ end
208
+
209
+ end
210
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler