service-objecter 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/service_objecter/result.rb +10 -3
- data/lib/service_objecter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e7f5dfe652fa47ee641199f109021521b1cd5d7
|
4
|
+
data.tar.gz: 2dd5b18e7e6c73df41cd1b03167bbc802eba5047
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 012d76b936b3f178636e68eaefe72d807cb047fd56ef3ed1243b99ca3fef86632b2bcfa10386906be04401de1dd020c88305f6d9babb160819ff60445abd41ee
|
7
|
+
data.tar.gz: 2fa4dde94676f6d829775f5cd7fd50154b6016044438b8223980378e613459be86f7aa7efc5d61716786f49b616bd9f12b69e9d21b6f3fdec6c587cd0b8a8cdb
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module ServiceObjecter
|
2
2
|
class Result
|
3
|
-
def initialize(success, value = nil)
|
4
|
-
@success, @value = success, value
|
3
|
+
def initialize(success, value = nil, store = nil)
|
4
|
+
@success, @value, @store = success, value, store
|
5
5
|
end
|
6
6
|
|
7
7
|
def push(success, value = nil)
|
8
8
|
@success = success
|
9
9
|
store.merge!(value) if value.is_a?(Hash)
|
10
10
|
@value = value
|
11
|
-
self
|
11
|
+
self.class.new(@success, @value, store)
|
12
12
|
end
|
13
13
|
|
14
14
|
def success?
|
@@ -30,5 +30,12 @@ module ServiceObjecter
|
|
30
30
|
def store
|
31
31
|
@store ||= Hash.new
|
32
32
|
end
|
33
|
+
|
34
|
+
def as_json(_ = nil)
|
35
|
+
{
|
36
|
+
success: @success,
|
37
|
+
value: value
|
38
|
+
}
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|