Ruby console intruder
-
i have just downloaded and installed 6.4.120 in one of my machines to see if it runs ok. just at startup it greets me with the ruby console. i know it is telling me there is a problem to be solved but what exactly? and why should be me the one to fix it? see pict attached.
thanks for any help.
-
This should go to the ruby discussions, Edson, I believe - you'd most probably get an answer quicker. If you think I can move - or as an admin, you can move it yourself...
-
yes, sure.
-
The author of the script trim_extend.rb, on line #96, used some ruby syntax that generates a warning. It won't affect the operation of the script, per se. That's the first message.
The rest of the messages are "garbage" debugging messages the author of a script (not necessarily trim_extend, but that's very suspect), left in the source code that should be cleaned up and removed.
Todd
-
... and be careful with String methods:
(eval);217; warning; string pattern instead of regexp; metacharacters no longer effective
Would be possible to overwrite the String methods, converting String arguments to Regexp objects. If anyone is interested ...
Printing out "'garbage" debugging messages' without having $DEBUG enabled shouldn't be done. We all know, that the Ruby console is a time consumer because of it's auto-scrolling.
azuby
-
hi azuby,
but how do i get rid of the annoying intrusion?
-
It's just a warning, not an error, so it isn't critical. You can edit line 96 of trim_extend.rb on your own. I think, there you will have a statement formated like this:
foo bar baz
You need to edit it to
foo bar(baz)
or
foo(bar(baz))
. Or just write the line down here and we'll correct it.
The other garbage ... well it's not easy to find where it comes from if you have lots of Ruby scripts in your Sketchup folders. In "Tools/sandboxtools.rb" you can find some statements, lines 31, 36, 40, 44 beginning with "puts" Behind the statement you can write
if $DEBUG
The other thing with "dirs=" you can find in "Tools/totd.rb", line 86. Put the same string behind the statement.
azuby
-
Can someone check if Sketchup changed the version of the Ruby Interpreter (normally 1.8), because these messages maybe a sign of an evolution on the Ruby side.
-
thanks, azuby. i'll try it and let you know what happened.
just to make sure i get it right (being english not my native language): when you say behind the statement are you saying before it?
regards.
-
This error occurs on lines 47, 48, 95 and 96. It's because there's a method that has a variable sent to it and there's a white-space gap between them, thus [I've put a ' ^ ' where the gap is as a single space isn't too clear in the text used for 'code' here...]:
do_something ^ (with_this)
rather than the faultless:
do_something(with_this)
The lines read:
47 d1=(pt1.position.distance (ext1[0])).to_f if ext1 != nil 48 d2=(pt2.position.distance (ext2[0])).to_f if ext2 != nil 95 d1=(pt1.position.distance (ext1[0])).to_f if ext1 != nil 96 d2=(pt2.position.distance (ext2[0])).to_f if ext2 != nil
The lines should read:
47 d1=(pt1.position.distance(ext1[0])).to_f if ext1 != nil 48 d2=(pt2.position.distance(ext2[0])).to_f if ext2 != nil 95 d1=(pt1.position.distance(ext1[0])).to_f if ext1 != nil 96 d2=(pt2.position.distance(ext2[0])).to_f if ext2 != nil
It relatively easy to change them using Notepad.exe to edit the text... Make each of the four 'distance (' into 'distance('
-
"Behind": Change
puts "foo"
to
puts "foo" if $DEBUG
The other way would be:
if $DEBUG puts "foo" end
This also would be possible :
puts "foo" unless !$DEBUG
@Fredo6
They still have Ruby 1.8.0 implemented since ... don't know - maybe Sketchup 4?azuby
Advertisement