Wed Apr 25
#
Rails core
Jeremy K. - render :xml => @<%= file_name %>, :status => :created, :location => <%= file_name %>_url(@<%= file_name %>)
Jeremy K. - love that one liner
Michael K. - reminds me of a job I had writing perl code that would generate perl code
Michael K. - $$$$$$$$$${{{
#
Ad hoc polymorphism with a “recursive” lambda
class Contract < Array # ... def hours_for(date) locator = lambda do case date when Date lambda {|work| date == work.date} when Range lambda {|work| date.include? work.date} when Numeric year = Date.today.year date = if date > 2000 D(date, 1)..D(date, 12) else D(year, date)..D(year, date + 1) end redo end end select(&locator.call).sum :hours end # ... end