class NamedProc

Class for a proc that’s got a name

Constants

VERSION

Attributes

name[R]

Public Class Methods

create(name, block, create_lambda = false) click to toggle source

Create a named proc from a given proc/lambda object

# File lib/named_proc/implementation.rb, line 15
def self.create(name, block, create_lambda = false)
  if create_lambda
    lambdafyer = Module.new
    lambdafyer.singleton_class.send(:define_method, :lambdafy, &block)
    block = lambdafyer.method(:lambdafy).to_proc
  end
  new(name.to_sym, &block)
end
new(name) click to toggle source
Calls superclass method
# File lib/named_proc/implementation.rb, line 5
def initialize(name)
  @name = name
  super()
end

Public Instance Methods

inspect() click to toggle source
Calls superclass method
# File lib/named_proc/implementation.rb, line 10
def inspect
  super.sub /^#<#{self.class}/, "#<#{self.class}[#{name}]"
end