Skip to content

Instantly share code, notes, and snippets.

@mikepack
mikepack / 1_inheritance.rb
Last active August 29, 2015 14:07
5 Composition Techniques
class Animal
def run
puts 'running'
end
end
Animal.new.run #=> running
class Wolf < Animal
def follow_pack
@mikepack
mikepack / .irbrc
Created October 15, 2014 21:59
My .irbrc
require 'irb/completion'
require 'brice'
Brice.init do |config|
config.exclude 'libs'
end
IRB.conf[:AUTO_INDENT] = true
@mikepack
mikepack / cars.rb
Created February 11, 2015 05:02
Polymorphic Cars
class Car
def drive
# get_in
start_engine
accelerate
# park
end
end
class Ford < Car
@mikepack
mikepack / null_object.rb
Created February 11, 2015 05:02
Polymorphic Null Object
class User
def name
'Mike Pack'
end
end
class GuestUser
def name
'Guest User'
end

Keybase proof

I hereby claim:

  • I am mikepack on github.
  • I am mikepack (https://keybase.io/mikepack) on keybase.
  • I have a public key ASAoHHutu5Q4xJx7dLfSuriZV7fgxkmWw1XRRm2JTcGM9go

To claim this, I am signing this object: