Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 529 Bytes

README.rdoc

File metadata and controls

32 lines (24 loc) · 529 Bytes

MixMaster

A pure ruby solution for mixing & unmix modules from classes.

module Foo
  def foo
    'foo'
  end
end

class Baz
  mixin Foo
end

b = Baz.new
=> #<Baz:0x6aa48c>
b.foo
=> "foo"

Baz.mixout Foo
=> [Foo]

Baz.new.foo
NoMethodError: undefined method `foo' for #<Baz:0x69a640>
	from (irb):30
b.foo
NoMethodError: undefined method `foo' for #<Baz:0x6aa48c>
	from (irb):31

Inspiration

Both _why’s and Dan Manges’ libraries (mixico and mixology) have been of great inspiration.