lab42_core 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50b79fb53cb3eabf40d9a75db01d945d338b5dfc
4
- data.tar.gz: 60df674bd40c480f1dbfd62ac5c11b0a3bf5a7ba
3
+ metadata.gz: 09c0a8b896de5f071922b7f891e9999cab9b90db
4
+ data.tar.gz: e915798f131ae1e8abca5b188241b160529da795
5
5
  SHA512:
6
- metadata.gz: 65fa1b525bee1585344538b8d1b86fcc657d62803c1ee7afd74f36e0ae5c26cdf1761bc617aac5679f856315a8ce746cd5ca3b893cc72225548e1114b5cb5e64
7
- data.tar.gz: 169ec69933e737e28809724d47d1e71816f6a927fb3649f76538310c1bd0ada7869fad22f726f29f6fe9c2e762ec791e1dfb60e95f41d622bcfeb969abbc4bb0
6
+ metadata.gz: 452ba90e65b3766819f2d9498e244adca8192a043a09106f1acc488f19fbf0ea6e0594d2a446af3723fdada19a28d7d14cfada4daa175e113bd3e879b2b58f8d
7
+ data.tar.gz: 349b2363b45160bdaff3cf29633120ca4ba59ea60bbda98d0b8887a4a6d1fcd270eb48933e7e5c5542a8535fccde4dbac2b96a3f7f97522d02ebbd81bac576cc
@@ -1,5 +1,15 @@
1
1
  require_relative 'hash'
2
2
  class Module
3
+
4
+ def lazy_attr sym, &blk
5
+ raise ArgumentError, 'missing initialization block' unless blk
6
+ define_method sym do
7
+ ivar_name = "@__#{sym}__"
8
+ return instance_variable_get( ivar_name ) if instance_variable_defined? ivar_name
9
+ instance_variable_set ivar_name, instance_eval( &blk )
10
+ end
11
+ end
12
+
3
13
  def memoize sym
4
14
  orig_method = instance_method sym
5
15
  define_method sym do |*args|
@@ -1,5 +1,5 @@
1
1
  module Lab42
2
2
  module Core
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end # module Core
5
5
  end # module Lab42
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lab42_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
147
  - - ">="
148
148
  - !ruby/object:Gem::Version
149
- version: 2.0.0
149
+ version: 2.1.0
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="