Skip to content

Instantly share code, notes, and snippets.

View dwaller's full-sized avatar

David Waller dwaller

  • Microsoft (Yammer)
  • Seattle, WA, USA
View GitHub Profile
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"
end
alias_method :[], :read_attribute
@dwaller
dwaller / bottles.rb
Created July 2, 2014 10:15
SPA 2014 exercise
class Bottles
def song
verses(99, 0)
end
def verses(upper_bound, lower_bound)
upper_bound.downto(lower_bound).map { |i| verse(i) }.join("\n")
end