Skip to content

Instantly share code, notes, and snippets.

David Waller dwaller

  • Microsoft (Yammer)
  • Seattle, WA, USA
View GitHub Profile
View active_record_mimic.rb
require 'model_attribute'
module ActiveRecordMimic
def self.included(base)
base.instance_eval do
unless (class << base; self; end).ancestors.include?(ModelAttribute)
raise "ActiveRecordMimic aliases ModelAttribute methods so must be included after extending ModelAttribute"
alias_method :[], :read_attribute
dwaller / bottles.rb
Created Jul 2, 2014
SPA 2014 exercise
View bottles.rb
class Bottles
def song
verses(99, 0)
def verses(upper_bound, lower_bound)
upper_bound.downto(lower_bound).map { |i| verse(i) }.join("\n")
You can’t perform that action at this time.