ViewComposer 0.1.3 → 0.1.4
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 +4 -4
- data/lib/ViewComposer/base_composer.rb +13 -2
- data/lib/ViewComposer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0f39caa21c19edfda37bcb55bdaf219fb716e0b
|
4
|
+
data.tar.gz: 4d79b5ae56239d868d2f45bd8943bc8ad1d9b234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d27ed05f84c5f0a3d1e2848881e3907d8045b8608992c4473f76b3645f8b4271c2dbc10a0cc5a2d248bcf55d0d741e1136136fd36769de05929fa88fc07a20ae
|
7
|
+
data.tar.gz: 01e11b6713eee33503ee06d4dba9043cbc0c7ebd2299f2592a967add0c3c0c2e74540d5e33766459d73312ff4f3b768287738fa9cc7cc1a70bcae4ab56a46169
|
@@ -12,6 +12,7 @@ class BaseComposer
|
|
12
12
|
attr_accessor :_attributes,
|
13
13
|
:_instance_attrs,
|
14
14
|
:_model_methods,
|
15
|
+
:_instance_defined_methods,
|
15
16
|
:_inherited_methods
|
16
17
|
end
|
17
18
|
self._attributes = []
|
@@ -24,6 +25,7 @@ class BaseComposer
|
|
24
25
|
@model = model
|
25
26
|
@json_hash = {}
|
26
27
|
set_model_methods
|
28
|
+
set_instance_defined_methods
|
27
29
|
set_attributes_methods
|
28
30
|
setup_comp_objs(composable_objects)
|
29
31
|
methods_to_hash
|
@@ -38,6 +40,7 @@ class BaseComposer
|
|
38
40
|
super
|
39
41
|
base._attributes = self._attributes.dup
|
40
42
|
base._inherited_methods = self._inherited_methods.dup
|
43
|
+
base._model_methods = self._model_methods.dup
|
41
44
|
end
|
42
45
|
|
43
46
|
def hash_attrs
|
@@ -62,6 +65,14 @@ private
|
|
62
65
|
end
|
63
66
|
end
|
64
67
|
|
68
|
+
def set_instance_defined_methods
|
69
|
+
if self.class._instance_defined_methods != nil
|
70
|
+
self.class._instance_defined_methods += self.class._model_methods
|
71
|
+
else
|
72
|
+
self.class._instance_defined_methods = self.class._model_methods
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
65
76
|
def instance_attributes
|
66
77
|
@instance_attributes ||= self.class._instance_attrs || []
|
67
78
|
end
|
@@ -104,7 +115,7 @@ private
|
|
104
115
|
end
|
105
116
|
|
106
117
|
def definable_methods
|
107
|
-
self.class._model_methods
|
118
|
+
self.class._instance_defined_methods + self.class._model_methods
|
108
119
|
end
|
109
120
|
|
110
121
|
def setup_comp_objs(comp_objs_array)
|
@@ -116,7 +127,7 @@ private
|
|
116
127
|
end
|
117
128
|
|
118
129
|
def define_methods(method_names, method_owner)
|
119
|
-
method_names.each do |attr|
|
130
|
+
method_names.uniq.each do |attr|
|
120
131
|
self.class.send(:define_method, attr) do
|
121
132
|
method_owner.send(attr)
|
122
133
|
end
|
data/lib/ViewComposer/version.rb
CHANGED