mongoid-dsl 1.3.0 → 1.3.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/mongoid-dsl/monkey.rb +7 -40
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd257f582c3267f141ccd5672f2de45977cc642b
4
- data.tar.gz: 47ba60150ca1fe1661f19c1ad9f9e7fcd2df6ae3
3
+ metadata.gz: 47808c4061e31b1839ec661b8c922f503215ac15
4
+ data.tar.gz: d01fac305de47f5936409eb3f6b53760f2732731
5
5
  SHA512:
6
- metadata.gz: df21aa404447a4acf7a13cb3390692d35ab53e91ca257c908cd5be197e8ea05a7fbdb6619b26d91fed1f173b02844b44d92816b7e7dd88e76c7b1d4c76b2818e
7
- data.tar.gz: aaefea258bc8d5edf32322d7d9784d405207eec162a2b1f9a10594326107064f6bd718ede54fc6f911f9f172176b1cf7dc64f0dac50cc5c07e34fd7bb7c9f86d
6
+ metadata.gz: 9d367c54d6e0759f727ad1480de130666350a0ab90b12f097db2632581af72c4ba2691189bfaf52ae0ac4ab0f9ab8157fd100f3ae857ea80e30a94059e4c2a36
7
+ data.tar.gz: 572c3645fe47dd7dc7a4bc11bbc02235257a8df073f9bfd0fe6cb487278b3a03f9d3297f134497533819ded25705657026d0bbeb103772c125f496a096ad9a0a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
@@ -330,9 +330,9 @@ module Mongoid
330
330
  begin
331
331
 
332
332
  deep_level = (full_path.count) || 0
333
- chains= full_path
333
+ chains = full_path
334
334
 
335
- if !full_path.empty? && !full_path.nil?
335
+ if !full_path.nil? && !full_path.empty?
336
336
  full_path= full_path.join('.')+'.'
337
337
  else
338
338
  full_path= String.new
@@ -467,22 +467,6 @@ module Mongoid
467
467
 
468
468
  end
469
469
 
470
- # TODO find out how to add elements to a criteria obj
471
- # # convert to mongid criteria
472
- # begin
473
- #
474
- # mongoid_crit= Mongoid::Criteria.new(self)
475
- #
476
- # puts mongoid_crit.methods - Object.methods
477
- #
478
- #
479
- # mongoid_crit.add_to_set return_data[0]
480
- #
481
- # return mongoid_crit
482
- #
483
- # rescue Exception
484
- # end
485
-
486
470
  return return_data
487
471
 
488
472
  end
@@ -495,29 +479,12 @@ module Mongoid
495
479
  end
496
480
 
497
481
  def _find(target_id)
498
-
499
- # pre validation
500
- begin
501
- if target_id.class != Moped::BSON::ObjectId && target_id.class != String
502
- raise ArgumentError, "id parameter must be id or ObjectId"
503
- end
504
- end
505
-
506
- # Do the Gangnam style
507
- begin
508
- return_doc = self._where( '_id' => target_id )[0]
509
- end
510
-
511
- return return_doc
482
+ return self._where(
483
+ '_id' => Moped::BSON::ObjectId.from_string(target_id.to_s)
484
+ )[0]
512
485
  end
513
486
  def _find_by(*args)
514
-
515
- # Do the Gangnam style
516
- begin
517
- return_array = self._where(*args).first
518
- end
519
-
520
- return return_array
487
+ return self._where(*args).first
521
488
  end
522
489
 
523
490
  #> [:none,:self,:one,:many]
@@ -604,7 +571,7 @@ module Mongoid
604
571
 
605
572
  Mongoid.models.each do |model_name|
606
573
  mongoid_model_name= model_name.mongoid_name
607
- unless [mongoid_model_name,mongoid_model_name+'s'].select{|mn| self.to_s == mn }.empty?
574
+ if [mongoid_model_name,mongoid_model_name+'s'].any?{|mn| self.to_s == mn }
608
575
  return model_name.to_s.constantize
609
576
  end
610
577
  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.3.0
4
+ version: 1.3.1
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-09-13 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler