rails/rails — pull request #3481 by bogdan (2011-10-31 15:27:43+00:00)
Title: ActiveSupport::Concern: allow #included to be called multiple times

### Use case

Suppose we have vendored module `A` (extended with `AS::Concern`). This module suppose to be included in class. We want this module to have some additional functionality from another module `B`. In this case I didn't find other way than alias-method-chain `self.included` (any suggestions?).

### API

After this patch we can just to do this:

``` ruby
A.included do
include B
end
```

In this case `B` will be included anytime when `A` got included.

### Implementation

I was thinking about 2 ways of doing it:

* store all passed blocks in Array and iterate
* merge new given block to previous by creating new block that calls both (see diff)

Decided prefer second one because there is no performance impact when calling `.included` only once (as it works right now) - no additional objects, no additional method calls.

Thanks.