lib/roda.rb in roda-3.24.0 vs lib/roda.rb in roda-3.25.0

- old
+ new

@@ -211,10 +211,14 @@ if check_dynamic_arity = opts.fetch(:check_dynamic_arity, check_arity) if keyword # Complexity of handling keyword arguments using define_method is too high, # Fallback to instance_exec in this case. b = block - block = lambda{|*a| instance_exec(*a, &b)} # Keyword arguments fallback + if RUBY_VERSION >= '2.7' + block = eval('lambda{|*a, **kw| instance_exec(*a, **kw, &b)}', nil, __FILE__, __LINE__) # Keyword arguments fallback + else + block = lambda{|*a| instance_exec(*a, &b)} # Keyword arguments fallback + end else arity_meth = meth meth = :"#{meth}_arity" end end