Module: Slotify::HelpersConcern
- Included in:
- Extensions::Base
- Defined in:
- lib/slotify/concerns/helpers_concern.rb
Instance Method Summary collapse
Instance Method Details
#make_compatible_with_slots(*method_names) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/slotify/concerns/helpers_concern.rb', line 3 def make_compatible_with_slots(*method_names) proxy = Module.new method_names.each do |name| proxy.define_method(name) do |*args, **kwargs, &block| return super(*args, **kwargs, &block) if args.none? results = MethodArgsResolver.call(args, kwargs, block) { super(*_1, **_2, &_3) } results.reduce(ActiveSupport::SafeBuffer.new) { _1 << _2 } end end prepend proxy end |