Two weeks ago I posted a short information concerning picking a topic for my Ruby-related e-book. I also included a link to a short, one-question survey and promised (in one of the comments) to post the results. So here they are!
Posts from the "Ruby" category:
For some time, I've been wondering whether writing a Ruby-related e-book would be a good idea. I missed writing, and in particular I wanted to work on something more challenging than just a blog post. It didn't take too long for me to make the decision whether I should write at all, but then another problem appeared: what topic should I choose?
First, I chose the topic I considered to be the most interesting, but then I changed my mind. And then again. And again.
Finally, I thought that the most interesting topic should be interesting not only for me as an author, but also for my potential readers. And this is what I need you help with. Please open the Google form I've created and answer one simple question: what Ruby-related e-book would you like to read?
Thanks in advance for your answers.
Text algorithms offer different ways of efficient text representation, processing and lookup. Ternary search tree is one of the most interesting data structures in its field of knowledge, as it combines storage efficiency with fast lookups and ability to perform a prefix search. I'll show you how this type of tree works and propose an example Ruby implementation, covered with specs.
How to check if given value is nil in Ruby? I'll show you not only how to do it, but also how it works in details. To be honest, explanation may seem a little bit confusing, especially for programmers having experience in other languages such as Java or C.
Curious readers may also read about an interesting feature of the Ruby interpreter, nil, true and false objects and their initialization.
Among filesystem and local memory, memcached is one of the most widely-used storage systems being adapted to cache data in web applications. I'll try to show different ways of integrating memcached with web applications in order to gain performance boost. Described techniques can be applied regardles of the framework (Ruby on Rails / Merb / Sinatra) and model layer library (ActiveRecord / DataMapper / Sequel) being used. I assume that reader has at least a basic understanding of what memcached is and how it can be used to store and retrieve data.
If you want to learn how to write Rake tasks, this tutorial is right for you!
You're going to learn what the build tools are in general. I will show you how to write your first simple Rake task and how to express dependencies between tasks. I will also cover some useful FileUtils methods.
Get intimate with Rake now!
Generally, it is a good idea to automate every boring, complicated programming task that often needs to be repeated. Firstly, developer's time and nerves can be spared. Secondly, the risk of doing something wrong (e.g. making a typo or leaving out one of the steps required) is minimized. Prepare the task once and don't repeat yourself anymore.
There are many tools available and the choice is determined principally by the language and environment we use. Some of the most well-know tools are make, Ant, Phing, Capistrano and Rake. In this short article, we are going to show how to write simple but powerful Rake task to run RSpec tests with code coverage meter.
A Hash in Ruby is a data structure that holds values in the key => value fashion. The Hash class provides many useful methods, some of them come from the Enumerable module. We won't go through all of them now, we'll rather focus on the often forgotten, but worth its value method: default().
We are also going to introduce the Null Object design pattern and show how it can be combined with the default() hash method.
Sometimes, when we are working with objects in Ruby, we want to make a copy of them. But what for? Well, in most cases we want to have a working copy and still maintain the original, intact object. Changing a reference back to the primary object is much simpler than repairing object's state.
As we are going to show, Ruby object cloning may sometimes behave in an unexpected way. We are going to show why weird things happen and how to force Ruby to clone objects in the way we want. We will use clone method implementation and marshalling mechanism.