I’m not quite sure why I decided to do it, but I wrote some code to scrape all the constants defined by Sketchup (SU) into txt files. The only constants added from ‘native Ruby’ are the constants prefixed by ‘RUBY_’.
The files start with constants defined on Object, then constants scoped to SU class/module objects, then SU class/module objects with no constants.
I created four files, two for SU8 and two for SU2014. The _constants files are laid out in columns, the _constants_tab files are tab delimited. Same info, just different format.
They’re located at –
What I did –
First, I created a text file of all the constants defined by Ruby 2.2.3. Or, said another way, in a Ruby environment without SU.
Then, in SU, I created a hash from the items in that file, found all the constants in existence in SU, then removed any that were in the hash from the ‘Ruby only’ file.
While we have documented all public API, there are a bunch of useful constants that never seemed to have been documented. I’ve done what you just did a few times myself - to discover that constants are hidden in the system.
We got an issue open internally to improve this. I’m adding a link to this thread for reference.
The table with the RenderingOptions info is generated totally by code. It shows the link between RenderingOptions and RenderingOptionsObserver. I ran it in SU2014.
I’ve started a md template, and I’ll write code to populate the sections with constant tables, using the environment and the tab delimited file generated by find_su_constants.rb.
As I said ‘started’, so the md file has a few sections that have placeholders for the constant tables. I should also be able to include a list of constants that aren’t listed r yet categorized.
I added the file ‘find_su_constants.rb’ at GitHub. I doc’d it pretty well, if you want to run it (generate files for SU2015?), let me know. FWIW, all my development is under Windows.