Sha256: 6e29a204b9fb576f945225daf7aec1190982f85ac0eb88645fc85ca16a5620d0
Contents?: true
Size: 413 Bytes
Versions: 1
Compression:
Stored size: 413 Bytes
Contents
module DoubleDispatch module ClassMethods def dispatch_as(id) @dispatch_id = id end def dispatch_id @dispatch_id || fail('undefined :dispatch_id for class: ' + self.name) end end def self.included(base) base.extend(ClassMethods) end def double_dispatch(method_name, resolver, *args) resolver.send("#{method_name}_#{self.class.dispatch_id}", self, *args) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
double_dispatch-1.0.0 | lib/double_dispatch.rb |