Ruby 1.8.7 is missing #singleton_class
This commit is contained in:
parent
e347bdbee2
commit
cc8f79a640
@ -39,6 +39,12 @@ module Pacemaker
|
|||||||
from_definition(definition)
|
from_definition(definition)
|
||||||
end
|
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)
|
def from_definition(definition)
|
||||||
calling_class = self.singleton_class
|
calling_class = self.singleton_class
|
||||||
this_class = method(__method__).owner
|
this_class = method(__method__).owner
|
||||||
|
Loading…
x
Reference in New Issue
Block a user