cyrax 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDZiMThhZWY4ZDM0NGQ2ZWVjNzliZGVlMmQ3MmQ1MjVmODViOWZmZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjU4ZWRmNWU3ODA1MTE4OTliMDhjMmU3ZjUxYjRmOWIzY2MwNjRjNw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzE1MmZiNzA2ZWE2NjhhOGU2Zjg4NWFiODE5ZTEyZGQ2MmM0MmZjZWZlZTA1
|
10
|
+
ZDJiOTNhZGU2OGJhMjYwZDAxZDA1ZGRiMTU0MzA4OWViZWZkNDFlZTg0ZDg3
|
11
|
+
ZjE4YzA1ZDMzMDk3NjhlMjZlMDM1NmMyMjU4YjQwYmZiOWI1NmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWIxODQ2ZDc4NTZkZGUyNjZkMTkyY2RmYzc5ZDE5MDMyMzU3NjcxMjEyMWNh
|
14
|
+
Mjc1YTk3MzljOGY5ZDRiMjc5ZDRkMDc2MjA3YTNmNWU4MmFiNjliODIzMGQz
|
15
|
+
YzU2Njg1MjNlNjQ1YWU1ODcwMzVkNmQ0YWE1ZGZhOGNiNWRjNzE=
|
data/lib/cyrax/base_presenter.rb
CHANGED
@@ -19,9 +19,9 @@ class Cyrax::BasePresenter
|
|
19
19
|
|
20
20
|
def present_with_decoration(object, options)
|
21
21
|
if options[:present] == :collection
|
22
|
-
options[:
|
22
|
+
options[:decorator].decorate_collection(object)
|
23
23
|
else
|
24
|
-
options[:
|
24
|
+
options[:decorator].decorate(object)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class Cyrax::DecoratedCollectionPresenter < Cyrax::BaseCollectionPresenter
|
2
|
-
attr_reader :
|
2
|
+
attr_reader :decorator
|
3
3
|
|
4
4
|
def initialize(collection, options = {})
|
5
5
|
super
|
6
|
-
@
|
7
|
-
raise "Decorator class is not defined! Please define it with option :
|
6
|
+
@decorator = options[:decorator]
|
7
|
+
raise "Decorator class is not defined! Please define it with option :decorator" unless decorator
|
8
8
|
end
|
9
9
|
|
10
10
|
class << self
|
@@ -8,7 +8,10 @@ module Cyrax::Extensions
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def assign_resource(resource_name, resource, options = {})
|
11
|
-
|
11
|
+
if options[:decorator]
|
12
|
+
options.merge!(decorable: true)
|
13
|
+
resource = Cyrax::BasePresenter.present(resource, options)
|
14
|
+
end
|
12
15
|
@_assignments ||= {}
|
13
16
|
@_assignments[resource_name.to_sym] = resource
|
14
17
|
end
|
@@ -36,11 +39,12 @@ module Cyrax::Extensions
|
|
36
39
|
|
37
40
|
def respond_with(result, options = {})
|
38
41
|
name = options[:name] || response_name
|
42
|
+
result = result.result.to_model if result.is_a?(Cyrax::Response)
|
39
43
|
if respond_to?(:decorable?)
|
40
|
-
options.merge!(decorable: decorable?,
|
44
|
+
options.merge!(decorable: decorable?, decorator: decorator_class)
|
41
45
|
result = Cyrax::BasePresenter.present(result, options)
|
42
46
|
end
|
43
|
-
response =
|
47
|
+
response = Cyrax::Response.new(name, result)
|
44
48
|
response.message = @_message
|
45
49
|
response.errors = @_errors
|
46
50
|
response.assignments = @_assignments
|
data/lib/cyrax/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyrax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Droidlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|