structure 0.28.2 → 0.28.3

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 +3 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b16810e3d29cd7a4dfcd4d29770e3bb64d957363
4
- data.tar.gz: d962da4e33f36cb5ac38e1fce4a361c741368a8b
3
+ metadata.gz: d880d2f652bb1b6d883a586f69079f76803fb66b
4
+ data.tar.gz: cac8fb4496f4fc1980b3cacb3a138dbb1a2a0528
5
5
  SHA512:
6
- metadata.gz: 2f876d722febb6135262f030b44a809e4a5bec37583a47470e33d7f18670da56abecbc66b7fda033bdc28066d865a0d455ded1bd545eca049536e3219c0384e0
7
- data.tar.gz: 0912c0b0858fdd2cd77ad2bbe3ab5ed0505175eaf6fa6a6c107362f850e430716de2204461e1e15918f64fdbf03f9edbc7fee9b99b35f1061f40613d98a836fe
6
+ metadata.gz: 55849fa9ee47d40adb5c0659cdec68e21276e7609ec8b2c09a3819eafbc2345c6ca65c30dcfcfbf617c8e61199c345a7a981d556cf13a00e807c3bcbcbe25aa0
7
+ data.tar.gz: 12c3f3e2f1196a01be5cfb040e973a5f683e5c138fe9bc53e6b907d5d449d17769fd47f2420ef278c30a3d75905577e1f5855f261d0f539b6a0321bd96906fc4
data/structure.rb CHANGED
@@ -74,11 +74,13 @@ module Structure
74
74
  def attribute(name, &blk)
75
75
  name = name.to_s
76
76
  module_eval "def #{name}?; #{name}; end" if name.chomp!('?')
77
- module_eval "def #{name}; @#{name} ||= _#{name}.freeze; end"
77
+ module_eval "def #{name}; return @#{name} if defined?(@#{name}); @#{name} = _#{name}.freeze; end"
78
78
  define_method("_#{name}", blk)
79
79
  private "_#{name}"
80
80
 
81
81
  @attribute_names << name
82
+
83
+ name.to_sym
82
84
  end
83
85
  end
84
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.2
4
+ version: 0.28.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-17 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: me@hakanensari.com