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"
end
alias_method :[], :read_attribute
@dwaller
dwaller / bottles.rb
Created Jul 2, 2014
SPA 2014 exercise
View bottles.rb
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
You can’t perform that action at this time.