smooth_operator 1.10.21 → 1.10.22
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.
- checksums.yaml +8 -8
- data/lib/smooth_operator/array_with_meta_data.rb +3 -3
- data/lib/smooth_operator/attribute_assignment.rb +2 -2
- data/lib/smooth_operator/model_schema.rb +1 -10
- data/lib/smooth_operator/operator.rb +3 -3
- data/lib/smooth_operator/persistence.rb +2 -2
- data/lib/smooth_operator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWE4YzMxZjg0YmM1ZTFjNDIyOTYyM2FmOTI1Yzk0OWMxY2EwYWZjNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTU0YjgzMTI3YjY0MDFjNmIyMWI4MTBlNThjNThhYTFiN2RjM2QyNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmM0ZDU0NTgwYzdhMzEyZjc1MGI3N2MyODc2YThlZTQ5YzY0ODFhODMzNWQy
|
10
|
+
ZmZlZjI3MTM0YTQ1Y2M4OTkwMTNjNjQyYzViMWJhZjIxMDY1NzVlZWYxOTJi
|
11
|
+
MzFhNWY5NThiNDFkNjk5ZTIwMjNlOTVjYTQzZTdhYjg4NjczMTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Zjc5NDA3MTY4YmRmODYxZGNkMTgzNWQ1ZTk5YzRiMWVkNTY1NzdlOWY1YmY4
|
14
|
+
NGM5YjlmYTIwOTgwOTVhNWM5NGNmMGJmZmY2ZTAxYzkyYTI5MzNmNDA0ZDIz
|
15
|
+
NTQ5YjAyOGI1ODQyNDBmOTBiYTFhNGZlMzExY2FiZWExMThhMmU=
|
@@ -14,10 +14,10 @@ module SmoothOperator
|
|
14
14
|
_attributes = attributes.dup
|
15
15
|
|
16
16
|
@object_class = object_class
|
17
|
-
|
17
|
+
_resources_name = object_class.resources_name
|
18
18
|
|
19
|
-
@internal_array = [*_attributes[
|
20
|
-
_attributes.delete(
|
19
|
+
@internal_array = [*_attributes[_resources_name]].map { |array_entry| object_class.new(array_entry).tap { |object| object.reloaded = true } }
|
20
|
+
_attributes.delete(_resources_name)
|
21
21
|
|
22
22
|
@meta_data = _attributes
|
23
23
|
end
|
@@ -63,8 +63,8 @@ module SmoothOperator
|
|
63
63
|
|
64
64
|
attributes = _attributes = Helpers.stringify_keys(_attributes)
|
65
65
|
|
66
|
-
if _attributes.include?(resource_name)
|
67
|
-
attributes = _attributes.delete(resource_name)
|
66
|
+
if _attributes.include?(self.class.resource_name)
|
67
|
+
attributes = _attributes.delete(self.class.resource_name)
|
68
68
|
@_meta_data = _attributes
|
69
69
|
end
|
70
70
|
|
@@ -13,15 +13,6 @@ module SmoothOperator
|
|
13
13
|
def internal_structure
|
14
14
|
@internal_structure ||= self.class.internal_structure.dup
|
15
15
|
end
|
16
|
-
|
17
|
-
def resources_name
|
18
|
-
@resources_name ||= self.class.resources_name.dup
|
19
|
-
end
|
20
|
-
|
21
|
-
def resource_name
|
22
|
-
@resource_name ||= resources_name.singularize
|
23
|
-
end
|
24
|
-
|
25
16
|
|
26
17
|
module ClassMethods
|
27
18
|
|
@@ -31,7 +22,7 @@ module SmoothOperator
|
|
31
22
|
attr_writer :resources_name
|
32
23
|
|
33
24
|
def resource_name(default_bypass = nil)
|
34
|
-
@resource_name ||= (Helpers.super_method(self, :resource_name, true) || (default_bypass ? nil : self.model_name.to_s.underscore
|
25
|
+
@resource_name ||= (Helpers.super_method(self, :resource_name, true) || (default_bypass ? nil : self.model_name.to_s.underscore))
|
35
26
|
end
|
36
27
|
attr_writer :resource_name
|
37
28
|
|
@@ -75,10 +75,10 @@ module SmoothOperator
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def resource_path(relative_path, options)
|
78
|
-
|
78
|
+
_resources_name = options[:resources_name] || self.resources_name
|
79
79
|
|
80
|
-
if Helpers.present?(
|
81
|
-
Helpers.present?(relative_path) ? "#{
|
80
|
+
if Helpers.present?(_resources_name)
|
81
|
+
Helpers.present?(relative_path) ? "#{_resources_name}/#{relative_path}" : _resources_name
|
82
82
|
else
|
83
83
|
relative_path.to_s
|
84
84
|
end
|
@@ -115,7 +115,7 @@ module SmoothOperator
|
|
115
115
|
relative_path = id.to_s
|
116
116
|
else
|
117
117
|
options[:resources_name] = ''
|
118
|
-
relative_path = "#{parent_object.resources_name}/#{parent_object.id}/#{resources_name}/#{id}"
|
118
|
+
relative_path = "#{parent_object.class.resources_name}/#{parent_object.id}/#{self.class.resources_name}/#{id}"
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
@@ -133,7 +133,7 @@ module SmoothOperator
|
|
133
133
|
|
134
134
|
hash.delete('id')
|
135
135
|
|
136
|
-
{ resource_name => hash }.merge(data)
|
136
|
+
{ self.class.resource_name => hash }.merge(data)
|
137
137
|
end
|
138
138
|
|
139
139
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smooth_operator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Gonçalves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|