I am not sure if this is a known issue or not, but when yielding to a block w/ 2 arguments (e.g. arity = 2) its possible to freeze your app / test code. The following coding mistake should have resulted in a NoMethodError. Instead, Ruby freezes and I have to kill -9 the thread.
The following will freeze my app in its tracks. It should throw a NoMethodError.
module Entities
class Invoice < Grape::Entity
expose :id
expose(:foo) do |object, options|
bar.to_s
end
end
end
The only mistake above was not referencing object first.
module Entities
class Invoice < Grape::Entity
expose :id
expose(:foo) do |object, options|
object.bar.to_s
end
end
end
I'm happy to try to fix this - but first I'm asking if anyone else has noticed this or maybe there is already a PR for something similar?
I am not sure if this is a known issue or not, but when yielding to a block w/ 2 arguments (e.g. arity = 2) its possible to freeze your app / test code. The following coding mistake should have resulted in a
NoMethodError
. Instead, Ruby freezes and I have tokill -9
the thread.The following will freeze my app in its tracks. It should throw a NoMethodError.
The only mistake above was not referencing
object
first.I'm happy to try to fix this - but first I'm asking if anyone else has noticed this or maybe there is already a PR for something similar?
Versions
Ruby 2.7.3 Rails 6.1 grape (1.5.3) grape-entity (0.9.0)