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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWVmMmZjZmU3YTNiMGRiNDRkZmNkNTgyZjU4ZmE3N2FlZWY0NTMxMw==
4
+ YWE4YzMxZjg0YmM1ZTFjNDIyOTYyM2FmOTI1Yzk0OWMxY2EwYWZjNg==
5
5
  data.tar.gz: !binary |-
6
- YTgyMjM1YzExOTUzMzg4Mzc4NjI0NDQ1NTM0MDY2NzNkOWUxODllMQ==
6
+ NTU0YjgzMTI3YjY0MDFjNmIyMWI4MTBlNThjNThhYTFiN2RjM2QyNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzMxNThiMTBhODI1YTc0Y2NmYTQ0NDFiN2Y2NzE0NjNkYTA1ZTgxNGYwM2Iy
10
- ZGZmMjdkYWQ5MTQ2NmViOGYyYjYzYzRkM2JmMDY2ZTZhZjJhYjQ0ODFkYTkx
11
- Yzg2MzQxZGIwNjk4OTFjNGI0NTcyNGJiNGExYTMyZTg5OTE4YzY=
9
+ ZmM0ZDU0NTgwYzdhMzEyZjc1MGI3N2MyODc2YThlZTQ5YzY0ODFhODMzNWQy
10
+ ZmZlZjI3MTM0YTQ1Y2M4OTkwMTNjNjQyYzViMWJhZjIxMDY1NzVlZWYxOTJi
11
+ MzFhNWY5NThiNDFkNjk5ZTIwMjNlOTVjYTQzZTdhYjg4NjczMTE=
12
12
  data.tar.gz: !binary |-
13
- OWFjODBkZTYzZDdkMDAzZTAwOTJiZjhlYWIxM2M4MDM1YmM4NzFhZTRjODIx
14
- MGUyMWY5MTFhYmYxZGRhZjFjNjIyNzUzNmI3YTk5MDc3ZThjNWQwMGRhMTQx
15
- YjBjNzRhM2U1MmZlMjMxZjYxZDY1ZWU2YjgwYTBiZDExMTA4YjI=
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
- resources_name = object_class.resources_name
17
+ _resources_name = object_class.resources_name
18
18
 
19
- @internal_array = [*_attributes[resources_name]].map { |array_entry| object_class.new(array_entry).tap { |object| object.reloaded = true } }
20
- _attributes.delete(resources_name)
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.pluralize))
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
- resources_name = options[:resources_name] || self.resources_name
78
+ _resources_name = options[:resources_name] || self.resources_name
79
79
 
80
- if Helpers.present?(resources_name)
81
- Helpers.present?(relative_path) ? "#{resources_name}/#{relative_path}" : resources_name
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
@@ -1,3 +1,3 @@
1
1
  module SmoothOperator
2
- VERSION = "1.10.21"
2
+ VERSION = "1.10.22"
3
3
  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.21
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-15 00:00:00.000000000 Z
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler