rails/rails — pull request #3478 by avakhov (2011-10-31 08:47:48+00:00)
Title: Cycle helper method accepts nil as arguments

Not cycle method converts nil to blank string.

``` ruby
cycle(nil) # => ""
```

Moreover current Cycle::to_s a little bit confusing it changes internal state of object.

I suggest to tune cycle helper class implementation.

*Pros:*

It makes such haml template cleaner:

``` haml
%tr{:class => cycle('odd', nil)} # =>
instead
on the second iteration
= #...
```

This commit doens't affect documented behaviour, an example below will work fine.

``` erb

```

*Cons:*

If someone used undocumented trick cycle('odd', nil) + " some-another-class" he or she should update to cycle('odd', '') + " some-another-class. I think it's reasonalbe.