Ruby 1.8.7 is missing #singleton_class

This commit is contained in:
Adam Spiers 2014-02-04 19:42:53 +00:00
parent e347bdbee2
commit cc8f79a640

View File

@ -39,6 +39,12 @@ module Pacemaker
from_definition(definition)
end
# Make sure this works on Ruby 1.8.7 which is missing
# Object#singleton_class.
def singleton_class
class << self; self; end
end
def from_definition(definition)
calling_class = self.singleton_class
this_class = method(__method__).owner