Ruby question
-
Anyone heard of Iron Ruby? Is it the same language as SU Ruby?
-
I've not heard of it. Why does it matter? Are you an iron ruby expert?
-
@unknownuser said:
IronRuby is an implementation of the Ruby programming language targeting Microsoft .NET framework.
-
IronRuby refers to the programming language in which the Ruby language interpreter is written. The creator of Ruby invented the Ruby language, but implemented the interpreter using the c programming language. There are other Ruby implementations, the best-known written in Java and called JRuby. IronRUby is a Ruby Language implementation written for the .NET framework.
On Windows, SketchUp uses the original c language interpreter, which is included with SketchUp as a .dll library. The current version of SketchUp's Ruby is 1.8.6.
-
So a Ruby script written in IronRuby in .Net with DLR will execute in SketchUP?
-
Yes, Ruby is Ruby and should run on any implementation.
But any Ruby code which uses the SketchUp Ruby API methods or classes can only be run from SketchUp because that is the only environment where the methods exist.
-
@jim said:
Yes, Ruby is Ruby and should run on any implementation.
Except that SketchUp Ruby is not the full standalone Ruby - so it's quite possible that it won't work if it makes use of features that is missing in SketchUp. Or even modified - the Set class in SketchUp is not the same as the Set class in standalone Ruby. Due to that some Ruby libraries has fail to run under SketchUp.
-
@thomthom said:
@jim said:
Yes, Ruby is Ruby and should run on any implementation.
Except that SketchUp Ruby is not the full standalone Ruby - so it's quite possible that it won't work if it makes use of features that is missing in SketchUp. Or even modified - the Set class in SketchUp is not the same as the Set class in standalone Ruby. Due to that some Ruby libraries has fail to run under SketchUp.
Is that right? I believe the Ruby in SketchUp is the full language but with some extra hooks to support that proxy nature of Ruby objects wrt to the underlying COM stuff.
How is the behaviour of the Set class different?
-
@adamb said:
Is that right? I believe the Ruby in SketchUp is the full language but with some extra hooks to support that proxy nature of Ruby objects wrt to the underlying COM stuff.
How is the behaviour of the Set class different?
http://code.google.com/apis/sketchup/docs/ourdoc/set.html
Methods:- clear
- contains?
- delete
- each
- empty?
- include?
- insert
- length
- new
- size
- to_a
Compared to standard Ruby: http://ruby-doc.org/core/classes/Set.html
I believe it was some Googler that mentioned that it was not a full installation. Maybe they meant it was not a standard installation as they modify several methods in the base classes. And I have no idea why they did what they did to the
Set
class. I've been trying to get info on this for a while now.
I can't find the exact thread now, but I did find report is issues when some Ruby packages where tried within Su Ruby. http://forums.sketchucation.com/viewtopic.php?f=180&t=20297&start=0#p169325If you look at the lib/ruby/1.8/ folder for a standard Ruby install you find several classes missing. Base64 is one of them. I've not mapped out everything that's missing.
Advertisement