flex-scopes 1.0.5 → 1.0.6
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.
- data/VERSION +1 -1
- data/lib/flex/scope.rb +10 -3
- data/lib/flex/scopes.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/lib/flex/scope.rb
CHANGED
@@ -15,14 +15,16 @@ module Flex
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def respond_to?(meth, private=false)
|
18
|
-
super || is_template?(meth) ||
|
18
|
+
super || is_template?(meth) || is_context_scope?(meth) || is_self_scope?(meth)
|
19
19
|
end
|
20
20
|
|
21
21
|
def method_missing(meth, *args, &block)
|
22
22
|
super unless respond_to?(meth)
|
23
23
|
case
|
24
|
-
when
|
24
|
+
when is_context_scope?(meth)
|
25
25
|
deep_merge self[:context].send(meth, *args, &block)
|
26
|
+
when is_self_scope?(meth)
|
27
|
+
deep_merge self[:self_context].send(meth, *args, &block)
|
26
28
|
when is_template?(meth)
|
27
29
|
self[:context].send(meth, deep_merge(*args), &block)
|
28
30
|
end
|
@@ -34,9 +36,14 @@ module Flex
|
|
34
36
|
self[:context].respond_to?(:template_methods) && self[:context].template_methods.include?(name.to_sym)
|
35
37
|
end
|
36
38
|
|
37
|
-
def
|
39
|
+
def is_context_scope?(name)
|
38
40
|
self[:context].respond_to?(:scope_methods) && self[:context].scope_methods.include?(name.to_sym)
|
39
41
|
end
|
40
42
|
|
43
|
+
# only used for AR scopes, when you namespace the scope module
|
44
|
+
def is_self_scope?(name)
|
45
|
+
self[:self_context].respond_to?(:scope_methods) && self[:self_context].scope_methods.include?(name.to_sym)
|
46
|
+
end
|
47
|
+
|
41
48
|
end
|
42
49
|
end
|
data/lib/flex/scopes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flex-scopes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: flex
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.
|
21
|
+
version: 1.0.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.
|
29
|
+
version: 1.0.6
|
30
30
|
description: Provides an easy to use ruby API to search elasticsearch with ActiveRecord-like
|
31
31
|
chainable and mergeables scopes.
|
32
32
|
email: dd.nexus@gmail.com
|