Submission Status: Passed
Submitted for: March 10 - Using SimpleDelegator in Ruby to Implement the Decorator Pattern
Submitted at: August 02, 2017
require 'date' class Invoice attr_accessor :name def initialize(name) @name = name end def invoice_date Date.new(1989, 9, 10) end end class InvoiceDecorator < SimpleDelegator def invoice_month invoice_date.month end def last_name name.split.last end end
devCamp does not support ancient browsers.
Install a modern version for best experience.