Module: ProcessShared::DefineSingletonMethod

Included in:
Module
Defined in:
lib/process_shared/define_singleton_method.rb

Instance Method Summary collapse

Instance Method Details

#define_singleton_method(sym, &block) ⇒ Object

This method was added in Ruby 1.9.x. Include this module for backwards compatibility.

This isn't exactly compatible with the method in 1.9 which can take a Proc, Method, or a block. This only accepts a block.


8
9
10
11
# File 'lib/process_shared/define_singleton_method.rb', line 8

def define_singleton_method(sym, &block)
  eigenclass = class << self; self; end
  eigenclass.send(:define_method, sym, &block)
end