Skip to content

Instantly share code, notes, and snippets.

@asterite
Last active July 28, 2016 15:15
Show Gist options
  • Save asterite/0f39c4021a3785b59364a71a93775435 to your computer and use it in GitHub Desktop.
Save asterite/0f39c4021a3785b59364a71a93775435 to your computer and use it in GitHub Desktop.

Ruby lookup quiz

Please fill the output of every # => ... in the code below

Exercise 1

module Target1
end

class Parent1
end

class Child1 < Parent1
  puts Target1 # =>
end

Exercise 2

module Target2
end

class Parent2
  module Target2
  end
end

class Child2 < Parent2
  puts Target2 # =>
end

Exercise 3

module Namespace
  module Target3
  end

  class Parent3
    module Target3
    end
  end

  class Child3 < Parent3
    puts Target3 # =>
  end
end

Solutions

Running all of the code above the output is:

Target1
Parent2::Target2
Namespace::Target3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment