Registry / utility / functor

functor

JSON →
library0.6.1rbrubygemsunverified

Implements pattern-based dispatch for Ruby methods inspired by multi-methods.

gem install functor
INSTALL
IMPORT
SIG · FUNCTOR
F
functor
utilityrubyv0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Functor
require 'functor'

Define methods that dispatch based on argument types.

require 'functor' class Greeter extend Functor functor(:greet, String) { |name| "Hello, #{name}!" } functor(:greet, Integer) { |n| "Hello, number #{n}!" } end puts Greeter.new.greet('Alice') puts Greeter.new.greet(42)
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.6.1latest on RubyGems
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
functor — gem install functor · libregistry