Skip to content
forked from snusnu/procto

Turns your ruby object into a method object

License

Notifications You must be signed in to change notification settings

coverhound/procto

 
 

Repository files navigation

procto

Method objects. CoverHound wanted to specify method names sometimes, so we spun this off.

Usage

require 'procto'

class Greeter
  include Procto.call

  def initialize(text)
    @text = text
  end

  def call
    "Hello #{text}"
  end
  
  private
  attr_reader :text
end

Greeter.call('world') # => "Hello world"

class Printer
  include Procto.call(:print)

  def initialize(text)
    @text = text
  end

  def print
    "Hello #{text}"
  end

  private
  attr_reader :text
end

# Both methods are available:
Printer.call('world')  # => "Hello world"
Printer.print('world') # => "Hello world"

Credits

Copyright

Copyright © 2026 CoverHound. See LICENSE for details.

About

Turns your ruby object into a method object

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 82.8%
  • Shell 13.2%
  • Dockerfile 4.0%