Skip to content

Instantly share code, notes, and snippets.

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