funtools 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 +4 -4
- data/lib/funtools/composition.rb +0 -2
- data/lib/funtools/pattern-matching.rb +3 -3
- data/lib/funtools/recursion.rb +3 -3
- data/lib/funtools.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bf1edf4748979cc1a8bd8fd7036f196acf79be5
|
4
|
+
data.tar.gz: a74f26963a2927a2ccda5fc40e6fe692a700f7ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b2ae38662110e25e6fc4ca33963bf88a8736533904a94b227082d452be1b308ac294d300d6c882458bc2ddd1a501311fed933459a8a671b27df619d7cb01785
|
7
|
+
data.tar.gz: db923606370ba41994b62aa1429131d4654bc01cb3ca5af141ee8d3b0176c6667ed017b866050cbffe310f4d218dc237f4b2d7edeb7799e6146d2d50f221cf9c
|
data/lib/funtools/composition.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
class Object
|
4
2
|
# Public: Define a method in the current scope which allow pattern matching
|
5
3
|
# function declaration to be used.
|
@@ -27,7 +25,9 @@ class Object
|
|
27
25
|
|
28
26
|
yield
|
29
27
|
|
30
|
-
|
28
|
+
message = :define_method if respond_to?(:define_method, true)
|
29
|
+
message ||= :define_singleton_method
|
30
|
+
self.send(message, sym) do |*args|
|
31
31
|
patterns.each do |pattern|
|
32
32
|
result = pattern[args]
|
33
33
|
break result unless result.nil?
|
data/lib/funtools/recursion.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
class Object
|
4
2
|
# Public: Define a method in the current scope which will execute a given
|
5
3
|
# block recursively until a fixpoint is reached.
|
@@ -9,7 +7,9 @@ class Object
|
|
9
7
|
#
|
10
8
|
# Returns nothing.
|
11
9
|
def deftail(sym, &block)
|
12
|
-
|
10
|
+
message = :define_method if respond_to?(:define_method, true)
|
11
|
+
message ||= :define_singleton_method
|
12
|
+
self.send(message, sym) do |*n|
|
13
13
|
last = nil
|
14
14
|
[1].cycle.reduce(n) { |c, e| break c if last == c; last = c; block[c] }
|
15
15
|
end
|
data/lib/funtools.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: funtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tina Wuest
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Tools to assist in programming in a more functional style
|
14
14
|
email: tina@wuest.me
|