matilda-function 0.2.0 → 0.3.0

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
  SHA1:
3
- metadata.gz: d6a79b4ecbcd4f088bac6217cba4b662535206f9
4
- data.tar.gz: e42e1c1880791e5f0cf156266bc5dab2e273d500
3
+ metadata.gz: 5bbd1d60599a3625f7d2610943f649a46523d771
4
+ data.tar.gz: 4e4db5f97a446594fa0eb5a6e86d71bf38c56d3d
5
5
  SHA512:
6
- metadata.gz: 007cd8ba7d50caf4f984754611b3278f17d464278b21405f276d1bb14915f2e80903cf472173802678b4fca1f39e7fd33874ea9ad91e4f7ae3250e5c47f47b7e
7
- data.tar.gz: e5e65c0c9d4e89d35d21a7de31896bd82270a9cf966a4a57af0b4120f0ab9e91ea7d3e1c146b57e645ddebdf54abb81baf26cb81b13d17d2a42107128c9695dd
6
+ metadata.gz: 27c2ba586324801cc13a0d086a86652ca57a60430d841b65c964e624d8ef84e64581cf558308067d80bf7261a79147cd52a888e321c2b604fd38dc609a8aab27
7
+ data.tar.gz: 7d9618bd7d94a706b9301b85e565b87545d98c13b6b1e2333b061ee10c5896e18c030ef293da040b80128444e198a063c22de956eb9f0430d32acc61c4033f13
@@ -18,6 +18,13 @@ class Proc
18
18
  end
19
19
  end
20
20
 
21
+ def +(func)
22
+ Proc.new do |*args|
23
+ self.call(*args)
24
+ func.call(*args)
25
+ end
26
+ end
27
+
21
28
  private
22
29
 
23
30
  class RecursiveStep
@@ -3,7 +3,7 @@ $:.unshift lib unless $:.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "matilda-function"
6
- s.version = "0.2.0"
6
+ s.version = "0.3.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Callum Stott"]
9
9
  s.email = ["callum@seadowg.com"]
@@ -34,4 +34,18 @@ describe "Proc" do
34
34
  (sort << reverse).call([1,4,2,3]).must_equal [4,3,2,1]
35
35
  end
36
36
  end
37
+
38
+ describe "#+" do
39
+ it "returns a Proc" do
40
+ func = Proc.new {} + Proc.new {}
41
+ func.kind_of?(Proc).must_equal true
42
+ end
43
+
44
+ it "returns a Proc that executes the callee and arg in order" do
45
+ sort = Proc.new { |array| array.sort! }
46
+ reverse = Proc.new { |array| array.reverse! }
47
+
48
+ (sort + reverse).call([1,4,2,3]).must_equal [4,3,2,1]
49
+ end
50
+ end
37
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matilda-function
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Callum Stott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-08 00:00:00.000000000 Z
11
+ date: 2013-08-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: