Listen to extension action
module MyMod
def MyMod.extend_object(obj)
puts "Extending object id #{obj.id}, type #{obj.type}"
super
end
end
x = [1, 2, 3]
x.extend(MyMod)
# Output:
# Extending object id 36491192, type Array
Related examples in the same category