smooth_operator 1.10.20 → 1.10.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/smooth_operator/attribute_assignment.rb +14 -10
- 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
|
+
MWVmMmZjZmU3YTNiMGRiNDRkZmNkNTgyZjU4ZmE3N2FlZWY0NTMxMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTgyMjM1YzExOTUzMzg4Mzc4NjI0NDQ1NTM0MDY2NzNkOWUxODllMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzMxNThiMTBhODI1YTc0Y2NmYTQ0NDFiN2Y2NzE0NjNkYTA1ZTgxNGYwM2Iy
|
10
|
+
ZGZmMjdkYWQ5MTQ2NmViOGYyYjYzYzRkM2JmMDY2ZTZhZjJhYjQ0ODFkYTkx
|
11
|
+
Yzg2MzQxZGIwNjk4OTFjNGI0NTcyNGJiNGExYTMyZTg5OTE4YzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWFjODBkZTYzZDdkMDAzZTAwOTJiZjhlYWIxM2M4MDM1YmM4NzFhZTRjODIx
|
14
|
+
MGUyMWY5MTFhYmYxZGRhZjFjNjIyNzUzNmI3YTk5MDc3ZThjNWQwMGRhMTQx
|
15
|
+
YjBjNzRhM2U1MmZlMjMxZjYxZDY1ZWU2YjgwYTBiZDExMTA4YjI=
|
@@ -70,7 +70,7 @@ module SmoothOperator
|
|
70
70
|
|
71
71
|
options.each { |key, value| @_options[key] = value } if options.is_a?(Hash)
|
72
72
|
|
73
|
-
attributes.each { |name, value| push_to_internal_data(name, value) }
|
73
|
+
attributes.each { |name, value| push_to_internal_data(name, value, true) }
|
74
74
|
end
|
75
75
|
|
76
76
|
def parent_object
|
@@ -99,7 +99,7 @@ module SmoothOperator
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
def push_to_internal_data(attribute_name, attribute_value)
|
102
|
+
def push_to_internal_data(attribute_name, attribute_value, cast = false)
|
103
103
|
attribute_name = attribute_name.to_s
|
104
104
|
|
105
105
|
return nil unless allowed_attribute(attribute_name)
|
@@ -107,9 +107,9 @@ module SmoothOperator
|
|
107
107
|
known_attributes.add attribute_name
|
108
108
|
|
109
109
|
if internal_data[attribute_name].nil?
|
110
|
-
initiate_internal_data(attribute_name, attribute_value)
|
110
|
+
initiate_internal_data(attribute_name, attribute_value, cast)
|
111
111
|
else
|
112
|
-
update_internal_data(attribute_name, attribute_value)
|
112
|
+
update_internal_data(attribute_name, attribute_value, cast)
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -133,17 +133,21 @@ module SmoothOperator
|
|
133
133
|
|
134
134
|
private ######################## PRIVATE #############################
|
135
135
|
|
136
|
-
def initiate_internal_data(attribute_name, attribute_value)
|
137
|
-
|
138
|
-
|
139
|
-
|
136
|
+
def initiate_internal_data(attribute_name, attribute_value, cast)
|
137
|
+
if cast
|
138
|
+
internal_data[attribute_name] = new_attribute_object(attribute_name, attribute_value)
|
139
|
+
|
140
|
+
internal_data[attribute_name] = internal_data[attribute_name].value unless self.class.dirty_attributes?
|
141
|
+
else
|
142
|
+
internal_data[attribute_name] = attribute_value
|
143
|
+
end
|
140
144
|
end
|
141
145
|
|
142
|
-
def update_internal_data(attribute_name, attribute_value)
|
146
|
+
def update_internal_data(attribute_name, attribute_value, cast)
|
143
147
|
if self.class.dirty_attributes?
|
144
148
|
internal_data[attribute_name].set_value(attribute_value, self)
|
145
149
|
else
|
146
|
-
internal_data[attribute_name] = new_attribute_object(attribute_name, attribute_value).value
|
150
|
+
internal_data[attribute_name] = cast ? new_attribute_object(attribute_name, attribute_value).value : attribute_value
|
147
151
|
end
|
148
152
|
end
|
149
153
|
|
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.21
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|