mug 1.2.4 → 1.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/mug/enumerable/hash-like.rb +7 -7
- data/lib/mug/fragile-method-chain.rb +11 -1
- data/lib/mug/maybe.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6a1368f80be0c11d5fc8614b1e9548dddef502fffd929bd6e01b6bc705737c8
|
4
|
+
data.tar.gz: 9a1bb6550a0ac33d484c2fd52fad34a82035ec6af4df4446ecfa099dd92b78d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbf884f4d7b2e3dac6e0a4623d27a831430e9446be804cb99d0cb44fadd6d9de4eb7dc0bcc8f99c930d33b24702ea955d6c1be599f78baacd626f1b9eb829a88
|
7
|
+
data.tar.gz: 06dc7216fac287a0838c9efa7a477a9d83fc9957141c7da4f566ffa2e3a42c3a7b2c50abfe2eeb8e1433afa072caac832f46d963370ce95cb145a71fdc2216a2
|
@@ -47,7 +47,7 @@ module Enumerable
|
|
47
47
|
return v if k == key
|
48
48
|
end
|
49
49
|
if args.length > 1
|
50
|
-
|
50
|
+
default
|
51
51
|
elsif block_given?
|
52
52
|
yield key
|
53
53
|
else
|
@@ -78,12 +78,12 @@ module Enumerable
|
|
78
78
|
break if remain < 1
|
79
79
|
|
80
80
|
key_indices = key_map[k]
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
next unless key_indices
|
82
|
+
|
83
|
+
key_indices.each do |key_index|
|
84
|
+
result[key_index] = v
|
85
|
+
define[key_index] = true
|
86
|
+
remain -= 1
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -34,6 +34,16 @@ class FragileMethodChain
|
|
34
34
|
self
|
35
35
|
end
|
36
36
|
|
37
|
+
# If the object is resolved, defer. Otherwise, sure, I
|
38
|
+
# respond to anything, I guess.
|
39
|
+
def respond_to_missing? meth, priv
|
40
|
+
if __defer?
|
41
|
+
@o.respond_to_missing? meth, priv
|
42
|
+
else
|
43
|
+
true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
37
47
|
# Explicitly invoke :_? as a method in the chain.
|
38
48
|
def _? #:nodoc:
|
39
49
|
# Unconditionally invoke it, so the eventual _! doesn't fail
|
@@ -60,7 +70,7 @@ class Object
|
|
60
70
|
end
|
61
71
|
|
62
72
|
=begin
|
63
|
-
Copyright (c) 2013,2016, Matthew Kerwin <matthew@kerwin.net.au>
|
73
|
+
Copyright (c) 2013,2016,2020, Matthew Kerwin <matthew@kerwin.net.au>
|
64
74
|
|
65
75
|
Permission to use, copy, modify, and/or distribute this software for any
|
66
76
|
purpose with or without fee is hereby granted, provided that the above
|
data/lib/mug/maybe.rb
CHANGED
@@ -21,6 +21,15 @@ class MaybeDelegator
|
|
21
21
|
def method_missing *a, &b #:nodoc:
|
22
22
|
@o && @o.send(*a, &b)
|
23
23
|
end
|
24
|
+
|
25
|
+
# This is a bit flakey, but I think it's meaningful.
|
26
|
+
def respond_to_missing? meth, priv
|
27
|
+
if @o
|
28
|
+
@o.repond_to_missing? meth, priv
|
29
|
+
else
|
30
|
+
true
|
31
|
+
end
|
32
|
+
end
|
24
33
|
end
|
25
34
|
|
26
35
|
class Object
|
@@ -42,7 +51,7 @@ class Object
|
|
42
51
|
end
|
43
52
|
|
44
53
|
=begin
|
45
|
-
Copyright (c) 2013, Matthew Kerwin <matthew@kerwin.net.au>
|
54
|
+
Copyright (c) 2013,2020, Matthew Kerwin <matthew@kerwin.net.au>
|
46
55
|
|
47
56
|
Permission to use, copy, modify, and/or distribute this software for any
|
48
57
|
purpose with or without fee is hereby granted, provided that the above
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Kerwin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
== MUG: Matty's Ultimate Gem
|