Module: Interpol::DefineSingletonMethod

Included in:
DynamicStruct
Defined in:
lib/interpol/define_singleton_method.rb

Overview

1.9 has Object#define_singleton_method but 1.8 does not. This provides 1.8 compatibility for the places we need it.

Instance Method Summary collapse

Instance Method Details

#define_singleton_method(name, &block) ⇒ Object



5
6
7
# File 'lib/interpol/define_singleton_method.rb', line 5

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