Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/including.rb
Instance Method Summary collapse
Instance Method Details
#including(mixin, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/including.rb', line 2 def including(mixin, = {}) include mixin and return unless [:only] || [:except] included_module = mixin.dup excluded_methods = ( [:except] || included_module.instance_methods(false) - [:only] ).map(&:to_sym) (include included_module).tap do excluded_methods.each do |meth| included_module.send(:undef_method, meth) end end end |