Skip to content

Instantly share code, notes, and snippets.

@ChuckJHardy
Created February 17, 2014 17:16
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 ChuckJHardy/9054879 to your computer and use it in GitHub Desktop.
Save ChuckJHardy/9054879 to your computer and use it in GitHub Desktop.
Using SimpleDelegator for Decorators
require 'delegate'
class CarDecorator < SimpleDelegator
def self.decorate(objects)
objects.map { |object| new(object) }
end
def car
__getobj__
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment