smooth_operator 1.2.7 → 1.2.8
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
|
+
N2UwNzVjODExYjU5ZDViZjZhNmQwYmNlMGU5NjkxOGQ5N2U3YWFhYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjgwNjE3MGYzMTQ5NWVkYzkzZjU1MWRjMmJmNjFjYjkwMmYxN2JiNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZThlZTRkMTMzMDcyMmE1MzU3ZDJkYzkxMzE2ZDU1NDUxZDc0NzFiN2M2ZmI3
|
10
|
+
ZDRjYjk0MWU1OGFhMWQ0MzllZWRlODM2YTczYTYyZGJmYzU3MmZkZTM1MWEx
|
11
|
+
ZGM5ZTAxNGJhOWVlM2QyMzM1NTI4N2Q0MjBkOThhYjA0MGM2NjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGJhZmMwZWJmOTVlMGIzMzgzMmE4NTAyN2Y4MzYyZTk4NmY4YjA0ZDQ3OTRj
|
14
|
+
OGY0NDZjYmJjNDE1ZGNhYzhhMGJjMmVkZDk4Nzc0MTUwMGEyNTVlZjhkODIz
|
15
|
+
OWQyN2U4NmExOGYxYjJjNGM0NWExZDI1ODFlMDA2YTEyOTIxNDg=
|
@@ -16,14 +16,26 @@ module SmoothOperator
|
|
16
16
|
object.class.reflect_on_association(association).klass.new(attributes)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
def build(attributes = {})
|
20
|
+
new_array, new_array_entry = get_array, new(attributes)
|
21
|
+
|
22
|
+
new_array.push new_array_entry
|
23
|
+
|
24
|
+
object.send("#{association}=", new_array)
|
25
|
+
|
26
|
+
new_array_entry
|
27
|
+
end
|
20
28
|
|
21
29
|
protected ############### PROTECTED ###############
|
22
30
|
|
23
|
-
def
|
31
|
+
def get_array
|
24
32
|
data = object.get_internal_data(association.to_s)
|
25
33
|
|
26
|
-
|
34
|
+
data.nil? ? [] : [*data]
|
35
|
+
end
|
36
|
+
|
37
|
+
def refresh
|
38
|
+
__setobj__ get_array
|
27
39
|
end
|
28
40
|
|
29
41
|
end
|