"baz!" b.foo # => "foo!" # works thanks to the mixin"> "baz!" b.foo # => "foo!" # works thanks to the mixin"> "baz!" b.foo # => "foo!" # works thanks to the mixin">
module SomeMixin
  def foo
    puts "foo!"
  end
end

class Bar
  include SomeMixin
  def baz
    puts "baz!"
  end
end

b = Bar.new
b.baz         # => "baz!"
b.foo         # => "foo!"
# works thanks to the mixin

Now Bar is a mix of its own methods and the methods from SomeMixin.

Note that how a mixin is used in a class depends on how it is added: