Method: DR::CoreExt::Proc#call_block

Defined in:
lib/dr/ruby_ext/core_modules.rb

#call_block(*args, **opts) ⇒ Object

Safely call our block, even if the user passed in something of a different arity (lambda case)



241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/dr/ruby_ext/core_modules.rb', line 241

def call_block(*args,**opts)
  if arity >= 0
    case arity
    when 0
      call(**opts)
    else
      call(args[0...arity],**opts)
    end
  else
    call(*args,**opts)
  end
end