Sadly, this reminds me of some of my friends.

#—-
# Excerpted from “Rails for PHP Developers”,
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/ndphpr for more book information.
#—-
class Assistant
attr_accessor :answered_calls

def initialize
@answered_calls = 0
end

def write_report
‘assistant writing report…’
end
end

class BossĀ 
# proxy undefined member/methods to assistant
def initialize(assistant)
@assistant = assistant
end

def method_missing(name, *args)
@assistant.send(name, *args)
end
end

assistant = Assistant.new
boss = Boss.new(assistant)

boss.answered_calls = 5
puts assistant.answered_calls
# => 5

puts boss.write_report
# => assistant writing report

posted 3 years ago