fancy_to_proc 0.2.1 → 0.3.0
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/README.md +13 -0
- data/lib/fancy_to_proc.rb +6 -0
- data/lib/fancy_to_proc/version.rb +1 -1
- 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: 5c6c587248ad21bf2748b2b41f0be82dccc75e1e
|
4
|
+
data.tar.gz: 39bce2ac0005f609016af55f1465b5dcace94a42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4652260c29264f999840bda0517dd89b1813ea1ee7ea8fb7daf352e5432815a5c6a72d3f1c3e96bcb5a1c92ecb58df13e0332cd81d6e15e88288b97e8937c7ea
|
7
|
+
data.tar.gz: 1e3822f3ebe1bb1c5a26cb3ba7f650d149cdb7d980c881c567222082bf64e68079f553e3040cf1ce5aaeff1a58ee55c9cfd105dc7f1bf5312123101e7e1a439e
|
data/README.md
CHANGED
@@ -53,6 +53,19 @@ Note, this is the unary tilde, so while it comes before it is actually just a me
|
|
53
53
|
|
54
54
|
I'm not sure how I feel about these methods. They have their uses and they're not _too_ crazy, but they're still a bit unintuitive and weird. As such I'm calling them experimental and may remove / change them. Feedback please! Also note that if you're already defining any of the methods in this gem then they won't be clobbered.
|
55
55
|
|
56
|
+
|
57
|
+
### [] Array to proc
|
58
|
+
|
59
|
+
Invokes the square brackets element reference method on Array or Hash.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
[["banana"], ["hammock"]].map &[0] # works on Array or Hash
|
63
|
+
[{ thing: "banana" }, { thing: "hammock" }].map &[:thing]
|
64
|
+
|
65
|
+
#=> ["banana", "hammock"]
|
66
|
+
```
|
67
|
+
|
68
|
+
|
56
69
|
### | pipe argument (Symbol)
|
57
70
|
|
58
71
|
Pass a single argument to a symbol method, slightly shorter than the above call brackets style. Specifically designed for this kind of case:
|
data/lib/fancy_to_proc.rb
CHANGED