liquefied 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/liquefied/version.rb +1 -1
- data/lib/liquefied.rb +11 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec6060c88a9184f0da1c1a1edd0fe69ed17e7bf
|
4
|
+
data.tar.gz: 14a2b17dcb0a4fb810337de2333ce831067c3280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 088a7820cc7dc5194ea7ff3b3d96ead14c4cf17ead994f0a282ad9256100b883e3022cab6d0933597288a08df086525b414adef1ba64277132fbe8a964a52bd0
|
7
|
+
data.tar.gz: 63cf1a10b5b38a45d3d8c54409af13dc3c37289e059a1d66a3ed8a2ad2a243b69ee9283cddb5eaa3becaaef4d909fd9c05c7b55dbe7ae960bc97778aaa383984
|
data/lib/liquefied/version.rb
CHANGED
data/lib/liquefied.rb
CHANGED
@@ -2,6 +2,10 @@ require 'liquefied/version'
|
|
2
2
|
|
3
3
|
class Liquefied < BasicObject
|
4
4
|
|
5
|
+
METHOD_ALIASES = [
|
6
|
+
[:to_s, :to_str]
|
7
|
+
]
|
8
|
+
|
5
9
|
# Public: Wrap an object with a default finalizer method
|
6
10
|
#
|
7
11
|
# The object remains wrapped and responds to all its original methods
|
@@ -38,7 +42,7 @@ class Liquefied < BasicObject
|
|
38
42
|
private
|
39
43
|
|
40
44
|
def method_missing(method, *args, &block)
|
41
|
-
if method
|
45
|
+
if _finalizer?(method)
|
42
46
|
_finalize!(*args, &block)
|
43
47
|
else
|
44
48
|
result = @original.public_send(method, *args, &block)
|
@@ -61,4 +65,10 @@ class Liquefied < BasicObject
|
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
68
|
+
def _finalizer?(method)
|
69
|
+
return true if method == @finalizer
|
70
|
+
both = [method, @finalizer]
|
71
|
+
METHOD_ALIASES.any? { |m| (m & both).size == 2 }
|
72
|
+
end
|
73
|
+
|
64
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquefied
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Vit
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,4 +96,3 @@ signing_key:
|
|
96
96
|
specification_version: 4
|
97
97
|
summary: Defer value formatting until output
|
98
98
|
test_files: []
|
99
|
-
has_rdoc:
|