Module Inheritance

Submitted By:
kbennoune

Difficulty:
Medium

Tags:
modules, classes, object-oriented programming

Instructions:
Make a module inherit from another. This is a little bit trickier than it looks.

Hidden Code:
There is hidden code with assertions that is also being run to test out your code.

Code:
module ChildModule
  ___
end

module ParentModule
  def parent_module_method
    'This should get called'
  end
end

class TestClass
  include ChildModule
end

assert_equal TestClass.new.parent_module_method, 'This should get called'

Your Solution

Ruby 1.9.3

Back to Problems