Skip to content

Instantly share code, notes, and snippets.

@kota
Created February 19, 2013 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kota/4983481 to your computer and use it in GitHub Desktop.
Save kota/4983481 to your computer and use it in GitHub Desktop.
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