Skip to content

Instantly share code, notes, and snippets.

@mathildathompson
Last active August 29, 2015 14:01
Show Gist options
  • Save mathildathompson/4ac51f281754b130762e to your computer and use it in GitHub Desktop.
Save mathildathompson/4ac51f281754b130762e to your computer and use it in GitHub Desktop.
def each(&block)
node = @head
while node
block.class(node.value)
end
end
#A minix a way of adding extra data to the class without having to use inheritance;
#You can only inherit from one class, a way to get around this is to created mixins;
module Mother
def eyes
:blue
end
end
module Father
def hair
:purple
end
end
class Son#You can only inherit from one things
include Mother
include Father
end
class Daughter < Father
end
module Insect
class Butterfly
end
end
Insect::Butterfly
ActiveRecord::Butterfly #This will group all of the Active Record classes together, it prevents conflicts very carefully;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment