t6d / smart_properties

Ruby accessors on steroids
MIT License
177 stars 20 forks source link

Fix check for including `ModuleMethods` #94

Closed paracycle closed 3 years ago

paracycle commented 3 years ago

The parameter passed to Module.included is always a Module so the check for deciding if the library should inject the ModuleMethods was not doing any checks at all.

Since a Class is always also a Module, the check should check to see if the parameter is not a Class instead. This makes sure that ModuleMethods is only included into modules and never to classes.

I also added a test to verify these expectations explicitly.