function-composite 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65b65fdf797182cb101d49ccd14034d7c6ea6c93beb15e802862fe669188b8d7
4
- data.tar.gz: 2dc04979b6ed0a95050c7e3356a6a45b071ba333facc2eb177225b1336b8038d
3
+ metadata.gz: 7d8d598e71699c70c2b263faab6f1a75ad05e51c0a26dda76f24b46963e0082a
4
+ data.tar.gz: 3bd2fdaf11799cbb0132652e33d19053bebdcbf75a85a6441fb9f1d2f1c8e258
5
5
  SHA512:
6
- metadata.gz: a695d0e7a8765743aacf752f5c6106c0f9d6b8312421946cdacb2db55091ce80d780c8981ade4b701a2803c07c90863929a5f27e61cfa5c0a4c775b5a4673c7e
7
- data.tar.gz: 8d476bf7da8bbf68cf0556d896c2800f39e08bc079e065e8d7bda393df4ca969349bf52849ee28062b91717550860dc9f44b9a5885199feb33e0e33e9700bb0c
6
+ metadata.gz: 0e8e702684c5dd71efba2b1b0a8814e5d5c2627c159c82bc455a6fabac84ce6d7bde2ece7498645ee0bedd5312bcebbc816711134c3dd3a9c80a292fe0a09655
7
+ data.tar.gz: 0ecbe1e884f4cb33053cca8403502a059cb1f6d75b99a43110a1061e1845215b4f0d7b5fc2e05b4043ac60ec6ab1f0c000ee178d6bbad688d6dd2bca01e7c838
@@ -1,6 +1,6 @@
1
1
  module Function
2
2
  module Composite
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
 
5
5
  refine(Symbol) do
6
6
  def call(*args, &block)
@@ -25,5 +25,15 @@ module Function
25
25
  super(other.to_proc)
26
26
  end
27
27
  end
28
+
29
+ refine(Method) do
30
+ def <<(other)
31
+ super(other.to_proc)
32
+ end
33
+
34
+ def >>(other)
35
+ super(other.to_proc)
36
+ end
37
+ end
28
38
  end
29
39
  end
@@ -27,9 +27,21 @@ class Function::CompositeTest < Test::Unit::TestCase
27
27
  assert_equal(["H", "e", "l", "l", "o"], result)
28
28
  end
29
29
 
30
+ def test_method_to_symbol
31
+ result = %w{72 101 108 108 111}.map(&method(:int) >> :chr)
32
+ assert_equal(["H", "e", "l", "l", "o"], result)
33
+ end
34
+
35
+ def test_symbol_from_method
36
+ result = %w{72 101 108 108 111}.map(&:chr << method(:int))
37
+ assert_equal(["H", "e", "l", "l", "o"], result)
38
+ end
39
+
30
40
  def test_symbol_to_callable
31
41
  h = {Alice: 30, Bob: 60, Cris: 90}
32
42
  result = %w{Alice Bob Cris}.map(&(:to_sym >> h))
33
43
  assert_equal([30, 60, 90], result)
34
44
  end
45
+
46
+ def int(s) s.to_i end
35
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: function-composite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobuyoshi Nakada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-09 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit