If you use Rails you could see and use class macros many times. For example we use it for defining associations in ActiveRecord models:

class User
  has_many :posts
end

has_many it's a class macro.

Hi! Today we have really interesting topic: Scope Gates and Flat Scope in Ruby. You will not use examples from this article in every day work, but it's really useful to know what Ruby allows to do with Scope.

Hi. Last couple years people say that Ruby is slow. Some people switch to more 'fast' languages. I think that Ruby is relatively slow language, but creators of Ruby made a huge work to make it faster. Last versions of Ruby work much much faster than previous ones.

Last week we discussed encapsulation and inheritance. Today we will discuss last part of basics of Object-Oriented Programming: Polymorphism.

Ruby - it's an object-oriented language. If we want to understand ideas that Matz put into Ruby - we should understand basics of object-oriented programming (OOP). In this post I'll cover encapsulation and inheritance. I'll devote separate post for polymorphism.

Recently I described how to use inject to solve relatively complex tasks in one-two lines of code.

Today I want to describe another useful method from Enumerable module - each_with_object.

Hey! In previous article we discussed blocks and today I'm going to describe lambdas and Procs. We will understand similarities and difference between them.

Today we're going to discuss simple but interesting topic. We will learn blocks by examples. We will understand what's block and how we can use it to create flexible apps.

Yes, this topic has been discussed many times and almost all people know that methods in Ruby can be public, private and protected. But it's not enough to know which access levels we have. Main point here to understand a difference. For example difference between private and protected levels of an access is not that obvious. So today I would like to talk about that difference.

Hey! I wrote couple posts about patterns (strategy, decorator and template). This list can not be complete without Factory Method pattern.