mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
11 lines
214 B
Ruby
11 lines
214 B
Ruby
module Kernel
|
|
def singleton_method(name)
|
|
m = method(name)
|
|
sc = (class <<self; self; end)
|
|
if m.owner != sc
|
|
raise NameError, "undefined method '#{name}' for class '#{sc}'"
|
|
end
|
|
m
|
|
end
|
|
end
|