Windowizer extension won't load in 2024

Here is the response I received from Rick…

Looks like the problem was with the “offset.rb” file. If you have a plain text editor like Notebook (on PC - I don’t know the Mac equivalent), you can change all “Fixnum” to “Integer”, then save the file. If you want to wait, I’ll see about getting a revised version posted to Smustard.com.

1 Like

Thanks! Seems to be working with those changes to the offset.rb file.

Also, if this extension still uses an "array.rb" file that modifies the Array class, it needs to be conditionally wrapped as Ruby 2.4+ (SketchUp 2019.0 and higher) defined a more robust summation method for the Array class and the Enumerable module.

unless [].respond_to?(:sum)
  class Array
    def sum
      if self.all? { |num| num.is_a?(Numeric) }
        self.inject(0) {|sum, n| sum + n }
      else
        return 0
      end
    end ### sum()
  end # class
end # conditional monkey patch

This method conflict is why it is generally a code violation to “monkey patch” core Ruby classes in a shared ObjectSpace.

For Ruby 2.0+ refinements can be used. Before this (SketchUp 2013 and older) either a custom subclass or a singleton method defined upon a specific array instance can be used (rather than “monkey patching”.)

2 Likes