sketchup-ruby-debugger
sketchup-ruby-debugger copied to clipboard
Function zip of enumerable module fails if debugger is enabled
The following code fails if debugging is enabled
class Vector
include Enumerable
def initialize(coordinates)
@coordinates = coordinates
end
def each(&block)
@coordinates.each(&block)
end
def +(other)
Vector.new(zip(other).collect { |x, y| x + y })
end
end
v1 = Vector.new([1.0, 2.0])
v2 = Vector.new([2.0, 3.0])
v1 + v2
The message is TypeError: no implicit conversion of nil into String
.
The code runs just fine if the debugging is not enabled.
An equivalent implementation without zip doesn't have this problem.
BTW: I know there is Vector
class in standard ruby library and Vector3d
in Sketchup API. This is just an example, how debugger fails.