Ruby is weird, feat. Starring into the void and few practices of the dark side of the Force

„It takes strength to resist the dark side. Only the weak embrace it!
It is more powerful than you know…“
―Obi-Wan Kenobi and Darth Maul [read more]

Void value expression – have you ever get this error? We had, and that’s how we discovered the void in Ruby. It happened yesterday, while we were working on the class creating test methods in our Ataru tool. The existence of void in Ruby surprised few of our coaches & friends.

Dirk and Lucas was very suprised about the dark side of the force

Dirk and Lucas was very suprised about the dark side of the force

We stayed cool this time, not knowing that it was a kind of discovery…

In the first attempt to write the above mentioned class, we used the define_method in the body of another method, which made us to use send method as well, as define_method is private. Send and define_method are useful, but they can also cause problems, if you don’t use them carefully.
Besides of the define_method, we are also using eval in our class. That is also potentially dangerous. Therefore it felt a bit like touching the dark side of the Force.

What is more, it caused our test methods to pass or to fail, depending on which test method was run as the first one. Today we worked hard to fix those issues. Supported by Jedi master coach Kacper we wrote a new method that is even more amazing than the old one. It solves the problem by creating a new class every time the method is called. It also wraps our code samples into a MiniTest test method.

You can check out our repo for the code:

https://github.com/CodePadawans/ataru/blob/code_ex/lib/ataru/code_samples.rb

you can see the results of running tests here:

Testing Ataru with Minitest

Testing Ataru with Minitest

And here’s how it made us feel like:

Even Star Trek guys are getting excited about this.

 

Lucas and Dirk (really awesome guys) are from Cologne and came to Berlin for eurucamp. They both were also guests in the new Asquera office. And yes, we assimilated them into our coaches cloud. 🙂

We learned a lot of important things from them:
using gifs for pull requests, getting a pink color scheme for the editor and cats instead those arrows for warnings in vim.
Amazing, isn’t it? They have to leave tomorrow, but we’ll see them soon again, at RedFrogConf, where we are giving our first talk!