scope_composer 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/scope_composer/scope.rb +1 -1
- data/lib/scope_composer/version.rb +1 -1
- data/spec/scope_composer/model_spec.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTRhOTUzOWM5YzA2N2VlMTE2M2Q0MDAwZDViNzE2NmUwYTlhYjIwZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGU2OGQ3NmFkMDU5MDY1MGNjMmNmYWNlMDU5MjQxZGY1MWRiMGI3MA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGJjZjdmYjBlOWQ0Njc0ZDliY2Y1N2U3ZjAyODA3MTZlY2MyMGY4ZGJiZjY0
|
10
|
+
ODFlZDNhM2Q2NDFlNTdjYzE3M2EzYWUyMjQyMjQ0YTg1NzBmMTAzOTExM2E5
|
11
|
+
YzgyMTc4MzZjMjA2ZDE2NzJkZTZjYjc1N2VhZmNmNzM0MWNiM2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGY4NzU3YjM3MDMzZTc1YzAwMWNkMzdjOTFmMjI2ZDQ0ZWZhZGI1NTg1ZmQ3
|
14
|
+
ZTRiY2NhNmU0YmNmNjFmZDg3OGY2NjdlOWQ4ZmQ2YmNkMjYzYzVhYmEzMDAx
|
15
|
+
MmI4YzJjZWQwNDFkOGFjY2MzYWI1NDM2ZmIxYzFiMjE1Mjc2Y2Y=
|
data/lib/scope_composer/scope.rb
CHANGED
@@ -92,7 +92,7 @@ class Scope
|
|
92
92
|
# define method
|
93
93
|
define_method(name) do |*args|
|
94
94
|
# if no value is given, act as a getter and retrieve the value
|
95
|
-
return read_scope_attribute(
|
95
|
+
return read_scope_attribute(name) if args.compact.blank?
|
96
96
|
# otherwise set the value
|
97
97
|
instance_exec(*args, &proc)
|
98
98
|
# and return self for chaining
|
@@ -7,7 +7,7 @@ describe ScopeComposer::Model do
|
|
7
7
|
include ScopeComposer::Model
|
8
8
|
|
9
9
|
has_scope_composer
|
10
|
-
scope :say_hi, ->(t){
|
10
|
+
scope :say_hi, ->(t){ scope_attributes[:say_hi] = t }
|
11
11
|
scope_helper :helper_method, ->(t){ 'hi' }
|
12
12
|
|
13
13
|
scope_composer_for :search
|
@@ -35,6 +35,11 @@ describe ScopeComposer::Model do
|
|
35
35
|
it "should define a scope helper" do
|
36
36
|
ScopeComposerModelTest.say_hi('hi').should respond_to :helper_method
|
37
37
|
end
|
38
|
+
|
39
|
+
it "should define a scope helper" do
|
40
|
+
t = ScopeComposerModelTest.say_hi('test')
|
41
|
+
t.say_hi.should eq 'test'
|
42
|
+
end
|
38
43
|
|
39
44
|
describe ".search_scope" do
|
40
45
|
let(:scope){ ScopeComposerModelTest.search_scope.new }
|