structure 0.28.6 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/structure.rb +9 -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: 6ed08697fcb78fd184a4051eaa84f027cbcd7a8d
|
4
|
+
data.tar.gz: c3cadb48c7d20fb8fe36688bb4436fd38c753689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8207ae458aa21cb2a51873d29dfe24555adf5fecaf807cfec2cb3ab2604c0f85f83e4f134efdb4f166b8ec291bb93f947eb568c453d93e047ee738ec5725461d
|
7
|
+
data.tar.gz: 00eb4ba174d39851d1a80f7bf379010e0a682ce6721300f8dff8d05d59bd4e372fa8fdca397971f0d1e2bb8f8c3d706f13a2a66e3db7aa14819bd5d2a5690000
|
data/structure.rb
CHANGED
@@ -85,7 +85,15 @@ module Structure
|
|
85
85
|
def attribute(name, &blk)
|
86
86
|
name = name.to_s
|
87
87
|
module_eval "def #{name}?; #{name}; end" if name.chomp!('?')
|
88
|
-
module_eval
|
88
|
+
module_eval <<-DEF
|
89
|
+
def #{name}
|
90
|
+
return @#{name} if defined?(@#{name})
|
91
|
+
@#{name} = _#{name}
|
92
|
+
@#{name}.freeze unless @#{name}.is_a?(Structure)
|
93
|
+
|
94
|
+
@#{name}
|
95
|
+
end
|
96
|
+
DEF
|
89
97
|
define_method("_#{name}", blk)
|
90
98
|
private "_#{name}"
|
91
99
|
|