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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzJiNWZiMGU0ZTczYjY5OTM2ZTZlYTc4OGU2ZjdkMjQyYzA3NjljMA==
4
+ MWVmMmZjZmU3YTNiMGRiNDRkZmNkNTgyZjU4ZmE3N2FlZWY0NTMxMw==
5
5
  data.tar.gz: !binary |-
6
- NzM0MmE2ZDJhZDYwZGVmNDAwMTNkMjMzZTFhOWQxZTQzYTEyNjE4Ng==
6
+ YTgyMjM1YzExOTUzMzg4Mzc4NjI0NDQ1NTM0MDY2NzNkOWUxODllMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzhjODI0NTRkZWZiOTIzMDJiZWRhNjlkYTE1MmFjNmIzMDQxNTYwNjQ4MGVl
10
- MTUxNGY4NTliNDc4YjA5MDA3MjAxMWM4ZWJkMzA3OGNmNDg4YjI0MjNmYjZm
11
- MDJjNmFmNjU0YmVkYmUwMzE5YzUzM2IzOGQ5NjE5MDZmMDc0ZDQ=
9
+ MzMxNThiMTBhODI1YTc0Y2NmYTQ0NDFiN2Y2NzE0NjNkYTA1ZTgxNGYwM2Iy
10
+ ZGZmMjdkYWQ5MTQ2NmViOGYyYjYzYzRkM2JmMDY2ZTZhZjJhYjQ0ODFkYTkx
11
+ Yzg2MzQxZGIwNjk4OTFjNGI0NTcyNGJiNGExYTMyZTg5OTE4YzY=
12
12
  data.tar.gz: !binary |-
13
- OTZiNGE4NjhmYjE2Y2FiNjlmN2E5YjY0ZWVlMjE5ZjIzMzhkZWRiNTU4ZWMw
14
- OTBkNzM1OGI5YTliMzE4MzE4NGY5MjA0ZTg2ZTUyMTE1MzdiZWI5ODBhY2Vk
15
- NDk2MTIxMTkyNTIyN2E4Y2E3MjdiYzI1YzhlOTQ4NDBkN2Y0ZWE=
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
- internal_data[attribute_name] = new_attribute_object(attribute_name, attribute_value)
138
-
139
- internal_data[attribute_name] = internal_data[attribute_name].value unless self.class.dirty_attributes?
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
 
@@ -1,3 +1,3 @@
1
1
  module SmoothOperator
2
- VERSION = "1.10.20"
2
+ VERSION = "1.10.21"
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.20
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-14 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler