Skip to content

Instantly share code, notes, and snippets.

@evandrojr
Created September 2, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evandrojr/9841e45f575e799a25f6 to your computer and use it in GitHub Desktop.
Save evandrojr/9841e45f575e799a25f6 to your computer and use it in GitHub Desktop.
Ruby OO
class myTask < Task # myTask is a subclass of Task
end
module Foo
def foo
puts 'heyyyyoooo!'
end
end
class Bar
include Foo
end
Bar.new.foo # heyyyyoooo!
Bar.foo # NoMethodError: undefined method ‘foo’ for Bar:Class
class Baz
extend Foo
end
Baz.foo # heyyyyoooo!
Baz.new.foo # NoMethodError: undefined method ‘foo’ for #<Baz:0x1e708>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment