How to check if there is an active internet connection with Ruby API?

I need to check if there is an active internet connection before opening a URL in HTMLDialog to show a warning message that user needs it.

But I couldn’t find a way to check it. Can anyone help me?

Sketchup.is_online

Note that I’m not sure if this method cache the results or not. (As in, if the network status changes during a session, I’m not sure if this method will reflect this.)

The method basically just ping a website - which you could do yourself with Ruby’s built int Net::Http or SketchUp’s Sketchup::Http modules: Module: Sketchup::Http — SketchUp Ruby API Documentation (In case you need full control over the internet check)