What version of Ruby should I start learning?
-
Hi guys,
I wanted to see if I could get some feedback on which version of Ruby I should learn and install. I know that SketchUp currently uses 1.8.6, and support for 1.9.3 or 2.0.0 is something we could only take a guess at.
I'm running Windows machines almost exclusively, so I wanted to see what version I should use. I know there's ways (at least on Mac with RVM) to switch between, but it's pretty over my head at the moment, so I'd like to keep it to as few variables as I can for learning. I snagged a copy of the Pick-Axe for 1.9.3 (and 2.0.0 I think) and am reading through that and reviewing "Why's Poignant Guide" as well.
Let me know your thoughts if you'd be so kind, thanks!
Matt
-
For Windows I usually recommend the Ruby Installer for Windows packages. Makes a simple task out of getting Ruby up and running: http://rubyinstaller.org/
-
Thomthom, any preference or suggestion as to 1.9.3 vs 2.0.0?
Sent from my XT1080 using Tapatalk
-
Those relevant parts of ruby that you as a beginner need are not different. I'd concentrate on the common denominator (which keeps your scripts compatible no matter what Ruby version is used). The differences lay really in more advanced details.
The poignant guid is quite enjoyable! -
Thanks Aerilius,
I'll probably just go with 1.9.3. Seems to be the most supported in general, the documentation's been out forever.
...and yes, I am indeed enjoying Why's Poignant Guide, because Chunky Bacon.
-
@matt.gordon320 said:
Thomthom, any preference or suggestion as to 1.9.3 vs 2.0.0?
If you're going to use it for SketchUp then it's logical to use whatever SketchUp uses. However, the differences isn't that great. Learning one language makes it much easier to understand any other languages - you would have understood the basic concepts. Going between versions are easier because it's usually a matter of features and perhaps minor syntax differences.
-
If you want your code to be compatible with SU8 and 2013 releases of SketchUp, you have to stick with Ruby 1.8, which is what's distributed with SU.
-
Sounds good gents, thanks. Ruby 1.8 it is then.
I think that'll be the better choice so that if I write something up and it doesn't work, at least it won't be as likely to be a version-dependent syntax error, instead it'll be my own syntax error
Looking forward to learning Ruby (in time) and seeing any of you at Base Camp!
-
Haha perfect timing for SketchUp 2014. Looks like I'll be learning Ruby 2.0.0 instead!
-
It hurt so much not being able to tell ya that last week.
-
@dan rathbun said:
It hurt so much not being able to tell ya that last week.
Ditto! I nearly ate my foot!
But the major concepts is still the same. It's mostly differ in terms of features and string handling. And you need to beware of the differences between the two if you want to be backward compatible.
-
@tt_su said:
@dan rathbun said:
It hurt so much not being able to tell ya that last week.
Ditto! I nearly ate my foot!...And you need to beware of the differences between the two if you want to be backward compatible.
Haha well said guys! I'll take that into account as I slowly plod my way through it. I definitely want things to be backward compatible if I can manage it. Looking forward to meeting up with everybody @ Base Camp next month if you're going!
-
The difficult thing is SketchUp has used 4 Ruby versions now.
Mac: v1.8.5-p0 < 14, and v2.0.0-p247 on 14
PC: v.1.8.0-p0 < 8, v1.8.6-p287 on 8 & 13, and v2.0.0-p247 on 14.
Older versions are missing some methods the newer versions have. A few methods here and there have been removed.
As for the API, some of the collection classes did not mixin
Enumerable
at all, some not correctly.I always wished for a master table, that listed missing methods, differences etc.
But I have never seen one even for normal Ruby. -
@dan rathbun said:
The difficult thing is SketchUp has used 4 Ruby versions now...I always wished for a master table, that listed missing methods, differences etc.
But I have never seen one even for normal Ruby.Thanks Dan, I'll have to bookmark this for reference. Knowing what little I know of Ruby thus far, I imagine that'd still be a hell of an undertaking! I think I'll focus on writing for 2.0.0 for now, and worry about stepping whatever I write successfully back down for previous versions later. One thing at a time for me. Are you making out to Base Camp this year, out of curiosity?
-
Base Camp, no. Too busy. Don't ski much. It seems like an excuse to get together and party, and I don't party.
-
Right right. Not much of a partier myself, however I am really looking forward to meeting some of the SketchUcation/Ruby community face to face.
Sent from my XT1080 using Tapatalk
-
Regarding the Ruby 2.0 shift, what's appening to the Sketchup 2014 API ?
It seems the API documentation is still the old one, out there, or at least I coudn't find nothing new about it and that sound strange to me because SU 2014 did introduced some new things (like BIM classification) so I expect to use it also programmatically.Another really important point would be the avaibility of a list of breaking changes (if any) so we can check ours plugins to remove potential bugs.
Any help will be really appreciated.
-
@nick60 said:
Another really important point would be the avaibility of a list of breaking changes (if any) so we can check ours plugins to remove potential bugs
+1
I usually try to study up on the API whenever I can, so anything additional like that would be awesome.
-
We had the longest changelog for the Ruby API ever with the SU2014 release: http://www.sketchup.com/intl/en/developer/docs/releases
We didn't document breaking changes from Ruby 1.8 to Ruby 2.0 as this has been documented extensively by the Ruby community in general.
We did have a breaking change where we moved the Set class to Sketchup::Set - and this is mentioned in the release notes.
API methods for classifiers where something we where unable to get into the last release because Classifiers where changing all too close to release. It is something that will come however.
We are also planning a whole new developer portal.
-
Thanks a lot!
Advertisement