dyoder-functor 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/functor.rb +3 -7
- metadata +2 -2
data/lib/functor.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "#{File.dirname(__FILE__)}/object"
|
2
|
-
require 'ruby-debug'
|
3
2
|
|
4
3
|
class Functor
|
5
4
|
|
@@ -56,7 +55,8 @@ class Functor
|
|
56
55
|
def match( *args, &block )
|
57
56
|
args << block if block_given?
|
58
57
|
pattern, action = @rules.reverse.find { | p, a | match?( args, p ) }
|
59
|
-
action or
|
58
|
+
action or
|
59
|
+
raise ArgumentError.new( "Argument error: no functor matches the given arguments." )
|
60
60
|
end
|
61
61
|
|
62
62
|
private
|
@@ -68,9 +68,5 @@ class Functor
|
|
68
68
|
def pair?( arg, rule )
|
69
69
|
( rule.respond_to? :call and rule.call( arg ) ) or rule === arg
|
70
70
|
end
|
71
|
-
|
72
|
-
def argument_error( args )
|
73
|
-
raise ArgumentError.new( "Argument error: no functor matches the given arguments." )
|
74
|
-
end
|
75
|
-
|
71
|
+
|
76
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyoder-functor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Yoder
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2008-
|
14
|
+
date: 2008-10-08 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|