mongoid-dsl 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/mongoid-dsl/monkey.rb +13 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f39e270dbec92926dffe278614230fcc9e404bba
|
4
|
+
data.tar.gz: e5239ffcf0fb792376df65b1339a2627d26569f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13aa7bc9b3a32a975714372d7cc5c9bb55ce83525f13723a81afe5260fb5c530317e4596b79279241018137131362ad5a832494e15f4df60b4130c1983653589
|
7
|
+
data.tar.gz: 97449c93b223e46603958d97353c8b54bd749972692b3f6d1e50f348d506c875e73e907d0a14b2505101bda0d5a767c68f1b2c9c297909eda44fae0c362243f5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/lib/mongoid-dsl/monkey.rb
CHANGED
@@ -587,32 +587,30 @@ module Mongoid
|
|
587
587
|
# convert mongoid name
|
588
588
|
def convert_model_name
|
589
589
|
|
590
|
-
unless self.class <= Class || self.class <= String || self.class <= Symbol || self.class <= NilClass
|
591
|
-
raise ArgumentError, "invalid input, must be Class or String: => #{self.class} (#{self})"
|
590
|
+
unless self.class <= ::Class || self.class <= ::String || self.class <= ::Symbol || self.class <= ::NilClass
|
591
|
+
return super;# raise ArgumentError, "invalid input, must be Class or String: => #{self.class} (#{self})"
|
592
592
|
end
|
593
593
|
|
594
|
-
if self.class <= NilClass
|
594
|
+
if self.class <= ::NilClass
|
595
595
|
return nil
|
596
596
|
end
|
597
597
|
|
598
|
-
case
|
598
|
+
case true
|
599
599
|
|
600
|
-
when
|
600
|
+
when self.class == ::Class
|
601
601
|
return self.to_s.split('::').last.underscore
|
602
602
|
|
603
|
-
when
|
604
|
-
Mongoid.models.each do |one_model_name|
|
605
|
-
if self.to_s == one_model_name.to_s.split('::').last.underscore || \
|
606
|
-
self.to_s == one_model_name.to_s.split('::').last.underscore+('s')
|
607
|
-
|
608
|
-
return one_model_name.to_s.constantize
|
603
|
+
when ![ ::Symbol, ::String].select{ |klass|self.class <= klass }.empty?
|
609
604
|
|
605
|
+
Mongoid.models.each do |model_name|
|
606
|
+
mongoid_model_name= model_name.mongoid_name
|
607
|
+
unless [mongoid_model_name,mongoid_model_name+'s'].select{|mn| self.to_s == mn }.empty?
|
608
|
+
return model_name.to_s.constantize
|
610
609
|
end
|
611
610
|
end
|
612
611
|
|
613
612
|
return self.to_s.split('::').last.underscore
|
614
613
|
|
615
|
-
|
616
614
|
end
|
617
615
|
|
618
616
|
return nil
|
@@ -622,18 +620,14 @@ module Mongoid
|
|
622
620
|
alias :mongoize_name :convert_model_name
|
623
621
|
alias :mongoid_name :convert_model_name
|
624
622
|
|
625
|
-
alias :mongoid_name_convert :convert_model_name
|
626
|
-
|
627
623
|
end
|
628
624
|
|
629
625
|
end
|
630
626
|
|
631
627
|
# for manual include
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
klass.__send__ :extend,Mongoid::DSL::Document::Extend
|
636
|
-
end
|
628
|
+
self.__send__ :include, Mongoid::DSL::Document::Include
|
629
|
+
def self.included klass
|
630
|
+
klass.__send__ :extend,Mongoid::DSL::Document::Extend
|
637
631
|
end
|
638
632
|
|
639
633
|
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.
|
4
|
+
version: 1.0.5
|
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-05
|
11
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|