Skip to content

Instantly share code, notes, and snippets.

@davidlbatey
Created May 2, 2013 00:18
Show Gist options
  • Save davidlbatey/5499364 to your computer and use it in GitHub Desktop.
Save davidlbatey/5499364 to your computer and use it in GitHub Desktop.
module List
def self.included(base)
base.extend ClassMethods
base.list = []
end
module ClassMethods
attr_accessor :list
def add item
list << item
end
def all
list
end
def first
list.first
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment