Skip to content

Perhaps simplify nested iteration in AnnotationEraserTool#erase_annotation_at() #2

Open
@DanRathbun

Description

@DanRathbun

Perhaps simplify nested iteration in AnnotationEraserTool#erase_annotation_at()

https://github.com/SketchUp/sketchup-annotations/blob/main/src/su_annotations/tools/annotation_eraser.rb
erase_annotation_at(), line 197, is a somewhat confusing nested iteration ...

      indicies = {}
      @curves.each { |type, curves|
        indicies[type] = []
        curves.each { |data|
          indicies[type] << data[:index]
        }
      }

... which might be simplified to ...

      indicies = @curves.map { |type, curves|
        [ type, curves.map { |data| data[:index] } ]
      }

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