structure 0.28.6 → 0.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/structure.rb +9 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bf9143686b35d2943e1f00ebd5d6d8ebd125f68
4
- data.tar.gz: af989c46bf1020bda14a60d37c2a177198b8096a
3
+ metadata.gz: 6ed08697fcb78fd184a4051eaa84f027cbcd7a8d
4
+ data.tar.gz: c3cadb48c7d20fb8fe36688bb4436fd38c753689
5
5
  SHA512:
6
- metadata.gz: 9e64253dab58e9f86054cc1306ff65b8062c73aaae8cd6ffced3e9d0fed3c24ffff250bb7cfacb9671d774726856e4049fb8d769a42bcc6da37d3dd9f96c437c
7
- data.tar.gz: 9b60d37cc9bf25968abcd3b22257d5b8c1297c2f4c8935db7c145c21a04c6d7844350b901c73c9c90bed43c9c12915ef77c123fc2c81dc887ecf806be0cf3c7b
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 "def #{name}; return @#{name} if defined?(@#{name}); @#{name} = _#{name}.freeze; end"
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.6
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari