Sha256: 9becbc3f49671ab7dc230164e4e11792a0a3956e630ccfecd46a97a3b90bd216
Contents?: true
Size: 518 Bytes
Versions: 12
Compression:
Stored size: 518 Bytes
Contents
class Object module SingletonMethods # returns the singleton class of an object def singleton_class class << self; self; end end # defines a method on an object def define_object_method(name, &block) singleton_class.send :define_method, name, &block end end include SingletonMethods end module SingletonMethods::Etest def test_singleton_methods s = "s" s.define_object_method :bla do "blabla" end assert_equal("blabla", s.bla) end end if VEX_TEST == "base"
Version data entries
12 entries across 12 versions & 1 rubygems