Skip to content

Function zip of enumerable module fails if debugger is enabled #36

@agilmartin

Description

@agilmartin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions