Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Help with inspecting mixed-in Ruby modules.
Add module-mixins
to your Gemfile.
gem 'module-mixins'
In order to find all classes that include a module you would typically track those via the Module.included callback.
module MyModule
attr_accessor :classes_including
def included(base)
self.classes_including ||= []
self.classes_including << base
end
end
This works well and is the behavior implemented in module-mixins by Module::Mixins::Included. You can extend
your modules instead of duplicating code.
module MyModule
extend Module::Mixins::Included
end
Ruby also provides a mechanism to enumerate all constants, which enables us to find mixed-in modules dynamically.
You can extend a module and call classes_including
similarly.
module MyModule
extend Module::Mixins::Including
end
You can also extend existing modules, which is quite powerful because you can apply it to modules you have not declared in your own code.
irb> Enumerable.extend Module::Mixins::Including
=> Enumerable
irb> Enumerable.classes_including
=> [Array, Hash, Struct, ..., Set, SortedSet]
You can also use a module method without needing to mix-in another module.
irb> Module::Mixins::Including.classes_including(Comparable)
=> [String, Symbol, Numeric, ..., Date, DateTime]
See CONTRIBUTING.
Copyright Daniel Doubrovkine and Contributors, Artsy Inc., 2015
FAQs
Unknown package
We found that module-mixins demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.