Skip to content

Commit

Permalink
Revert "added "includes" to instances"
Browse files Browse the repository at this point in the history
This reverts commit 0f3fd5e.
  • Loading branch information
vereena0x13 committed Dec 6, 2023
1 parent 58e7c47 commit 6a5ba96
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
3 changes: 0 additions & 3 deletions middleclass.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ local DefaultMixin = {
assert(type(self) == 'table', "Make sure that you are using 'Class:new' instead of 'Class.new'")
local instance = self:allocate()
instance:initialize(...)
instance.includes = function (self, mixin)
return self.class:includes(mixin)
end
return instance
end,

Expand Down
8 changes: 1 addition & 7 deletions spec/mixins_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local class = require 'middleclass'

describe('A Mixin', function()

local Mixin1, Mixin2, Class1, Class2, class1, class2
local Mixin1, Mixin2, Class1, Class2

before_each(function()
Mixin1, Mixin2 = {},{}
Expand All @@ -18,11 +18,9 @@ describe('A Mixin', function()

Class1 = class('Class1'):include(Mixin1, Mixin2)
function Class1:foo() return 'foo1' end
class1 = Class1()

Class2 = class('Class2', Class1)
function Class2:bar2() return 'bar2' end
class2 = Class2()
end)

it('invokes the "included" method when included', function()
Expand Down Expand Up @@ -56,10 +54,6 @@ describe('A Mixin', function()
assert.is_true(Class1:includes(Mixin2))
assert.is_false(Class2:includes(Mixin1))
assert.is_false(Class2:includes(Mixin2))
assert.is_true(class1:includes(Mixin1))
assert.is_true(class1:includes(Mixin2))
assert.is_false(class2:includes(Mixin1))
assert.is_false(class2:includes(Mixin2))
end)

end)
Expand Down

0 comments on commit 6a5ba96

Please sign in to comment.