Skip to content

Instantly share code, notes, and snippets.

@dkolath
dkolath / model_decorator.rb
Created January 6, 2017 23:18
decorator pattern that defines the method the first time it delegates
class ModelDecorator
module Decorated
def self.extended(base)
base.send(:include, InstanceMethods)
end
def decorate(object)
@decorated_object ||= object