Skip to content

Instantly share code, notes, and snippets.

@VictorTpo
Last active February 2, 2016 10:41
Show Gist options
  • Save VictorTpo/400bbf2e75e9bf43439e to your computer and use it in GitHub Desktop.
Save VictorTpo/400bbf2e75e9bf43439e to your computer and use it in GitHub Desktop.
module Bar
  def my_method
    'inside module'
  end
end

class Foo
  include Bar
  
  def my_method
    'inside class'
  end
end

x = Foo.new
p x.my_method
> 'inside class'

Time to prepend !

module Bar
  def my_method
    'inside module'
  end
end

class Foo
  prepend Bar
  
  def my_method
    'inside class'
  end
end

x = Foo.new
p x.my_method
> 'inside module'

Want more ? Look the movie (10min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment