I have following code:
module CarHelper
def call_helpline
puts "Calling helpline..."
end
end
class Car
extend CarHelper
end
class Truck
class << self
include CarHelper
end
end
# Test code
Car.call_helpline
Truck.call_helpline
In fact both 2 lines of test codes works. So is there any difference
between the way I use 'extend
' and 'include
' (inside a singleton class
of self
)?