Name: [799] chingav
Member: 111 months
Authored: 6 videos
Description: Chinmoy is a computer engineering student at The University of Texas at Austin. His hobbies are tennis and handball. His programming blog is located at ...

Introduction to Ruby II [ID:197] (2/6)

in series: Ruby Introductions

video tutorial by chingav, added 04/07

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

This video is about creating one's own classes. I walk through a bioinformatics class I ported from here: (Oreilly online's Beginning Python for Bioinformatics).

I talk about def initialize, instance variables, class variables, and a very quick note on regular expressions(which I talk more about in the third video).

Link to src:

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 9 (since July 30th)
  • Plays in last week: 0
  • Published: 112 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>

All comments excluding tick-boxed quick-comments

15. echte parajumpers jas 2014 Fri, 19 Feb 2010 23:40

it very good indeed, I understand 90%.

14. Bogner Anti-Statik- Antibakterielle Winter Wed, 20 Jan 2010 20:16

very good

13. anonymous Fri, 04 Dec 2009 07:29

Thanks again!!.

12. anonymous Sun, 19 Apr 2009 08:30

Great!!!! I like those tutorials !

11. anonymous Mon, 02 Mar 2009 02:37

thanks, i've gone through your first 2 tutorials and honestly this has been more helpful than anything else i've found so far. they're much appreciated

10. anonymous Sun, 20 Jul 2008 16:17

Hi, thank you so much for your series! I'm experiencing some problems when trying to use the DNA methods though. In your commented lines, you suggest using these methods as in dna.transcribe. But that does not return any output on the screen. So, in this case, do we need to insert a puts method somewhere inside the method definition? Thank you so much and sorry such a basic question (I'm a ruby newbie).

Hi Ref,

Glad you enjoyed the videos.

In regards to question 1: // works equally well instead of /\B/ (there must have been a typo somewhere). But basically /\B/ means "non-word boundary". But (//) seems to be better suited for extracting each character, so I would just use that (for example you see)

"words\t\nbleh blah".split(//)

=> ["w", "o", "r", "d", "s", "\t", "\n", "b", "l", "e", "h", " ", " ", " ", "b", "l", "a", "h"]


"words\t\nbleh blah".split(/\B/)

=> ["w", "o", "r", "d", "s\t", "\nb", "l", "e", "h ", " ", " b", "l", "a", "h"]

2.) You're absolutely right. @seq will not be modified even if I use collect!, so I might as well have used collect instead.



7. anonymous Sun, 04 Nov 2007 11:08

Hello chingav,

Thanks for this great series. These videos really helped clarify some stuff for me but I have two itches that need further clarification :)

1-) What does string.split(/B/) do or rather how is it different from string.split(//) ?

( Actually I was playing around with this code and split(/B/) wasn't working for me.

I checked and the example there uses split(//) to split "hello" into "h","e","l","l","o" so I changed /B/ to // and it started working.

Now, since I am a total ruby newb who is clueless about regex I am left wondering what was the /B/ supposed to do :) )

2-) Why are you using collect! ? I mean collect! is supposed to change the original object you are operating on right? Well that's not what you really need in this case I guess. I mean the original DNA sequence should not change everytime we ask for its complement. AND collect! can't really change the @seq because we split it into 5 different strings and convert those strings to an array. I don't know the innards of ruby but I guess the string object we start with is not the same object as the array object we end up with so using collect! or collect should have no difference. Am I right?

Actually now that I think about it... Isn't collect about applying a function to each member of a set and producing a different set which maps 1 to 1 to the source set? If it's about producing a new set, is there a reason to have collect! ?

Thanks again for the great series!



Hi Chinmoy - great, debugging videos will be an excellent addition! That's a skill that is always hard to learn by reading and so much easier to learn by seeing!


Hello everyone,

Coming Soon-->Screencast 6 and 7: I made them, but I will have to edit them, upload them, etc.

These cover using the built-in ruby debugger, using ruby-debug from the Data Noise blog, using the Tracer library to trace the execution of code and help pinpoint trouble spots, Unit Testing your code, and a really quick overview on showing the differences between Tkinter and Ruby/Tk when it comes to drawing lines on a canvas(I'll get into the details of this in a later screencast.

I haven't forgotten about the CSV library either. I will cover it later(there were a lot of votes for debugging, so I went ahead and covered those.

Some of you might have had trouble accessing the Box widget on my blog. It should be fixed now. Let me know if you have trouble.

Hello again,

I just remembered that I ported another Python script(this one was harder to do, so it might be more interesting). If anyone wants to look at it before I incorporate it into a future screencast, it is available at

It is a Markov Decision Process experiment ported from the Python code in Dr.Peter Norvig's article (he is a famous Google researcher)



Hi Ian and everybody,

Sure. I'll try to work in more ported code as examples.



Hi again Chinmoy. Great to see you show a bit of ported Python bioinformatics code!

Showing how to get started converting code to another language is nice, I hope we can get more of this sort of content (e.g. from Java to xxx...).



Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for chingav

Introduction to Ruby I

nice and simple. thanks

Bogner Anti-Statik- Atmungsaktiv Wandern
76 months ago
Introduction to Ruby II

very good

Bogner Anti-Statik- Antibakterielle Winter
79 months ago

By the Same Author

Related Videos



Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.