Sha256: 8350df40994d892244563b0cbd7cb7181814458ef973f404023aaecdd9423e19
Contents?: true
Size: 859 Bytes
Versions: 1
Compression:
Stored size: 859 Bytes
Contents
require "./performance/models" class ProductDecorator < Draper::Base decorates :product def awesome_title "Awesome Title" end # Original #method_missing def method_missing(method, *args, &block) if allow?(method) begin model.send(method, *args, &block) rescue NoMethodError super end else super end end end class FastProductDecorator < Draper::Base decorates :product def awesome_title "Awesome Title" end # Modified #method_missing def method_missing(method, *args, &block) if allow?(method) begin self.class.send :define_method, method do |*args, &block| model.send(method, *args, &block) end self.send(method, *args, &block) rescue NoMethodError super end else super end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
draper-0.10.0 | performance/decorators.rb |