Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby example of delegate design pattern.
class LazyProgrammer
attr_accessor :delegate_programmer
def initialize(programmer)
@delegate_programmer = programmer
end
def work
@delegate_programmer.work
end
end
lazy_p = LazyProgrammer.new(ChineseProgrammer.new)
lazy_p.work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.