diff --git a/lib/grape_entity/entity.rb b/lib/grape_entity/entity.rb index 2728b9f..7489b81 100644 --- a/lib/grape_entity/entity.rb +++ b/lib/grape_entity/entity.rb @@ -514,7 +514,7 @@ def serializable_hash(runtime_options = {}) end def exec_with_object(options, &block) - if block.parameters.count == 1 + if block.parameters.count == 1 || block.parameters == [[:req], [:rest]] instance_exec(object, &block) else instance_exec(object, options, &block) @@ -523,6 +523,7 @@ def exec_with_object(options, &block) # it handles: https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes point 3, Proc # accounting for expose :foo, &:bar if e.is_a?(ArgumentError) && block.parameters == [[:req], [:rest]] + Rails.logger.error("***** ERROR in exec_with_object: #{e.message}\n#{e.backtrace.join("\n")}") raise Grape::Entity::Deprecated.new e.message, 'in ruby 3.0' end diff --git a/lib/grape_entity/version.rb b/lib/grape_entity/version.rb index dae01ec..2f0868d 100644 --- a/lib/grape_entity/version.rb +++ b/lib/grape_entity/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module GrapeEntity - VERSION = '1.0.0' + VERSION = '1.0.1' end