epitools 0.5.33 → 0.5.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/epitools/core_ext/object.rb +4 -8
- data/lib/epitools/minimal.rb +6 -0
- 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: f282bea8aea914ccdd0930cd854a7923843f735c
|
|
4
|
+
data.tar.gz: 5a62ed975b9862079425b8b32789533995dfaa85
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67e406669118cbeaa5538fc4edb530bc0407a3c066efc5e13f34b598219001ddb700cf3038087e21e055b146bcb8c699cc4a1812889c4d3b25ef02496c6e8c12
|
|
7
|
+
data.tar.gz: 13a943e596d4944fb5f2c81939f707773a2404a1c333f07362143aa9db8816f0ce42dec7c79e9129c279dd5117957fa499cad64211da43d521f207775dd9d8f6
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.34
|
|
@@ -60,8 +60,9 @@ class Object
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
#
|
|
63
|
-
# Cache (memoize) the result of
|
|
64
|
-
#
|
|
63
|
+
# Cache (memoize) the result of an instance method the first time
|
|
64
|
+
# it's called, storing this value in the "@methodname" instance variable,
|
|
65
|
+
# and always return this value on subsequent calls.
|
|
65
66
|
#
|
|
66
67
|
def self.memoize(*methods)
|
|
67
68
|
methods.each do |meth|
|
|
@@ -69,6 +70,7 @@ class Object
|
|
|
69
70
|
|
|
70
71
|
if old_method.arity == 0
|
|
71
72
|
ivarname = "@#{meth}"
|
|
73
|
+
|
|
72
74
|
define_method meth do
|
|
73
75
|
instance_variable_get(ivarname) or instance_variable_set(ivarname, old_method.bind(self).call)
|
|
74
76
|
end
|
|
@@ -100,12 +102,6 @@ class Object
|
|
|
100
102
|
pretty ? JSON::pretty_generate(self) : JSON.dump(self)
|
|
101
103
|
end
|
|
102
104
|
|
|
103
|
-
#
|
|
104
|
-
# Proper grammar.
|
|
105
|
-
#
|
|
106
|
-
alias_method :is_an?, :is_a?
|
|
107
|
-
alias_method :responds_to?, :respond_to?
|
|
108
|
-
|
|
109
105
|
#
|
|
110
106
|
# Emit a quick debug message (only if $DEBUG is true)
|
|
111
107
|
#
|
data/lib/epitools/minimal.rb
CHANGED