to_proc 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/to_proc/Array.rb +19 -0
- data/lib/to_proc/all.rb +4 -1
- data/to_proc.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26e32799d86106d07c04df61e0f233424abaa594
|
4
|
+
data.tar.gz: 16d7bbd701584993d6b90d40bc1c5bc9aef2d2a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b09b963ca2506360ca7635f24bba6f9eb262a7ad215104bb390a085387b2829a72eb56648f6c271150b4c8eede6ec1b43919929b7d122d30aed1ac178447efa4
|
7
|
+
data.tar.gz: 53b19f2614fc30b13fbf32e875a712357a5474b9761331c97b7a42f9a6d368f754e1a376ee2ae06bdb2a539b6c16482961c817473089506e4fc6ba59813e6039
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Array
|
2
|
+
def to_proc
|
3
|
+
if self[0].is_a? Symbol
|
4
|
+
method, *arguments = self
|
5
|
+
-> receiver { receiver.send method, *arguments }
|
6
|
+
elsif self[1].is_a? Symbol
|
7
|
+
receiver, method, *arguments = self
|
8
|
+
if arguments.empty?
|
9
|
+
-> argument { receiver.send method, argument }
|
10
|
+
else
|
11
|
+
# if some arguments were passed as well,
|
12
|
+
# what is more reasonable for collection element?
|
13
|
+
# to become the first or the last argument?
|
14
|
+
end
|
15
|
+
else
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/to_proc/all.rb
CHANGED
data/to_proc.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_proc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoly Chernow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,6 +17,7 @@ extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/to_proc.rb
|
20
|
+
- lib/to_proc/Array.rb
|
20
21
|
- lib/to_proc/all.rb
|
21
22
|
- lib/to_proc/sugar.rb
|
22
23
|
- lib/to_proc/try.rb
|