LineTool example

Indeed, “sketchup.rb” is a script that (since SketchUp 2014,) gets loaded before any plugins or extensions get loaded. So the act of requiring it (since) is frivolous.

But this issue is discussed in another topic:
To require “sketchup.rb”, or not to … that is the question

In this specific case of “linetool.rb”, there appears to not be any use of the global methods defined in “sketchup.rb”, so the author may be using the require statement as a marker statement as Aerilius suggests (in the topic listed above.)

The “sketchup.rb” file is located in the “Tools” sub-directory of the SketchUp program directory. (… despite what it says at the top of the “su_examples.rb” and “examplescripts.rb” files.)

The “linetool.rb” file’s loading, is ultimately caused by the “su_examples.rb” extension registration script, in the “Plugins” directory, (which loads “examplescripts.rb”, which loads all the example scripts, in the “su_examples” extension sub-directory.)

In the “su_examples.rb” you’ll see the loading of “sketchup.rb”, “extensions.rb” and “langhandler.rb”. All 3 are located in the “Tools” sub-directory of the SketchUp program directory.

The functionality of “sketchup.rb” remains undocumented. (But this has been discussed ad nauseum elsewhere, and is a bit off-topic.)

The “extensions.rb” file defines the SketchupExtension class, which is documented.

The “langhandler.rb” file defines the LanguageHandler class, which has always had the .GetString method, but in response to a request by myself, (for SU2014+) they renamed it [] (square brackets) and aliased it as GetString. (To have extensions that still work with older versions, you’d need to use the old name. That is why they have not changed it.)
Some thing is wrong with the documentation generator as it is not listing the method aliases.

I personally use the square bracket method myself, and create singleton methods if a method response test is negative:

    @strings = LanguageHandler.new("my_plugin.strings")
    if !@strings.respond_to?(:[])
      def @strings.[](arg)
        self.GetString(arg)
      end
    end

The GetString name is not Rubyish, and shows the original author’s Java or Javascript roots. The square bracket accessor is the way it is done in Ruby for Hash-like objects, from which data is accessed by a key.