uinit-structure 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/uinit/structure/version.rb +1 -1
- data/lib/uinit/structure.rb +6 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cb370826705dbff7a6e5655c6d53e5b42dd58a2c5adfa25187b97532fb28ac8
|
4
|
+
data.tar.gz: e3e335c203daf426838917777d9205092c6ba6a574d057524c62583ac106c121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fd715aab45e5660901e17d31a59b4a7d9f9f280490904103ab14a37f92886852bcd57575835f9c5e75962f9a0d4f9aae43f093095b1455aea791b1c9650aba1
|
7
|
+
data.tar.gz: ca550ec25381be0da16da74b2c807b5b48365d58aff1e8da0c571d00c2f507220f1ec2e3126bcf25410f2b91141e2b511094739bfd37c2d05aaae169824e45fe
|
data/lib/uinit/structure.rb
CHANGED
@@ -24,7 +24,7 @@ module Uinit
|
|
24
24
|
class_methods do
|
25
25
|
include Memoizable
|
26
26
|
|
27
|
-
attr_reader :attributes
|
27
|
+
attr_reader :attributes, :attributes_scope
|
28
28
|
|
29
29
|
memo def structure_schema
|
30
30
|
if respond_to?(:superclass) && superclass.respond_to?(:structure_schema)
|
@@ -43,7 +43,8 @@ module Uinit
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def struct(&)
|
46
|
-
|
46
|
+
self.attributes_scope = AttributeScope.new(self)
|
47
|
+
attributes = attributes_scope.scope(&).attributes
|
47
48
|
|
48
49
|
attributes.each do |attribute|
|
49
50
|
raise NameError, 'Attribute must have a name' unless attribute.name
|
@@ -60,11 +61,13 @@ module Uinit
|
|
60
61
|
self.attributes = attributes.each_with_object(sup_attributes) do |attribute, hsh|
|
61
62
|
hsh[attribute.name] = attribute
|
62
63
|
end
|
64
|
+
|
65
|
+
self.attributes_scope = nil
|
63
66
|
end
|
64
67
|
|
65
68
|
private
|
66
69
|
|
67
|
-
attr_writer :attributes
|
70
|
+
attr_writer :attributes, :attributes_scope
|
68
71
|
end
|
69
72
|
|
70
73
|
memo def get_structure_schema = self.class.structure_schema
|