Skip to content

Instantly share code, notes, and snippets.

@jstorimer
Created June 18, 2012 17:29
Show Gist options
  • Save jstorimer/2949540 to your computer and use it in GitHub Desktop.
Save jstorimer/2949540 to your computer and use it in GitHub Desktop.
require 'active_support/core_ext/module/delegation'
Person = Struct.new(:name, :email)
class Designer
attr_reader :person
delegate :name, :email, :to => :person
def initialize(person)
@person = person
end
def design!
# do crazy designs
end
end
mark = Person.new("Mark", "m@mark.com")
designer = Designer.new(mark)
puts designer.name
puts designer.email
designer.design!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment