uberscore 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4822694e469030f33e07d66ddb926d5a6f2cbcdf
4
- data.tar.gz: acf43d2893f4addbf867a752975c44d9acdfcfd1
3
+ metadata.gz: 39563e475c0491d14d447db971e5e6064393da35
4
+ data.tar.gz: 1fe037f97071b82b716c0e901bccf88a230dbaee
5
5
  SHA512:
6
- metadata.gz: 416976187c2332a1b626ca2f3dbd86931b37878f0822c8421b1e2f418c80b61f979dd5d78f7675a7c4444c106bf2b8c933b6b0eac6fca4bd00a305227ebd5d8e
7
- data.tar.gz: cef66c9e18084f765495ca0b966c1ad2a82da0e41a42faa39232d7bb8c26830d51359ea0a5c2d5857f4af9051cf03386bda4a015e94832c1a6e58a5092c28c6c
6
+ metadata.gz: a31a07cea9dfa399501af6e8e19ccdd2d4323496607e896710be5f62247ceff7a023383d80c4a1a954e4bd17e8366b038803a79dbc01a727a581516eb3d93fd8
7
+ data.tar.gz: 02270ba32adad1567a57ccd999d5c73bca0abf194edfe28058f5c88b367ddc381c372357b8f1f4cd6a683e12300ed8770e97f8af464a43677775829c624b3034
data/README.md CHANGED
@@ -18,6 +18,10 @@ Born to make your Ruby blocks more concise.
18
18
  # Subscript.
19
19
  [{ name: "foo" }, { name: "bar" }].map { |hash| hash[:name] }
20
20
  [{ name: "foo" }, { name: "bar" }].map(&_[:name])
21
+
22
+ # Use multiple arguments.
23
+ [[1, 2], [3, 4]].map(&_ + _)
24
+ [[1, 2], [3, 4]].map { |a, b| a + b }
21
25
  ```
22
26
 
23
27
  ## Installation
@@ -1,3 +1,3 @@
1
1
  module Uberscore
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/uberscore.rb CHANGED
@@ -11,7 +11,6 @@ module Uberscore
11
11
  undef_method :!=
12
12
  undef_method :==
13
13
  undef_method :__id__
14
- undef_method :__send__
15
14
 
16
15
  def initialize
17
16
  @call_chain = []
@@ -25,7 +24,12 @@ module Uberscore
25
24
  def to_proc
26
25
  ->(object) do
27
26
  @call_chain.reduce(object) do |current, (name, args, block)|
28
- current.public_send(name, *args, &block)
27
+ case args.first
28
+ when Context
29
+ current[0].public_send(name, current[1], &block)
30
+ else
31
+ current.public_send(name, *args, &block)
32
+ end
29
33
  end
30
34
  end
31
35
  end
@@ -16,4 +16,8 @@ describe Uberscore do
16
16
  it "can subscript" do
17
17
  expect([{ name: "foo" }, { name: "bar" }].map(&_[:name])).to eq([{ name: "foo" }, { name: "bar" }].map { |hash| hash[:name] })
18
18
  end
19
+
20
+ it "can use two parameters" do
21
+ expect([[1, 2], [3, 4]].map(&_ + _)).to eq([3, 7])
22
+ end
19
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uberscore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ox0dea