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 +4 -4
- data/lib/lab42/core/memoization.rb +10 -0
- data/lib/lab42/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09c0a8b896de5f071922b7f891e9999cab9b90db
|
4
|
+
data.tar.gz: e915798f131ae1e8abca5b188241b160529da795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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|
|
data/lib/lab42/core/version.rb
CHANGED
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.
|
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.
|
149
|
+
version: 2.1.0
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
152
|
- - ">="
|