dyoder-functor 0.4.2 → 0.4.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.
Files changed (3) hide show
  1. data/lib/functor.rb +5 -1
  2. data/test/guards.rb +1 -1
  3. metadata +2 -2
data/lib/functor.rb CHANGED
@@ -44,6 +44,10 @@ class Functor
44
44
  match( args, &block ).call( *args )
45
45
  end
46
46
 
47
+ def []( *args, &block )
48
+ call( *args, &block )
49
+ end
50
+
47
51
  def to_proc ; lambda { |*args| self.call( *args ) } ; end
48
52
 
49
53
  private
@@ -59,7 +63,7 @@ class Functor
59
63
  end
60
64
 
61
65
  def pair?( arg, rule )
62
- ( rule.is_a?( Proc ) and rule.call( arg ) ) or rule === arg or rule == arg
66
+ ( rule.respond_to? :call and rule.call( arg ) ) or rule === arg or rule == arg
63
67
  end
64
68
 
65
69
  def argument_error( args )
data/test/guards.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'test/helpers'
1
+ require "#{File.dirname(__FILE__)}/helpers"
2
2
 
3
3
  describe "Dispatch should support guards" do
4
4
 
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.4.2
4
+ version: 0.4.3
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-06-29 00:00:00 -07:00
14
+ date: 2008-09-05 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies: []
17
17