step

d.step(limit[, step=1]) â enumerator
d.step(limit[, step=1]){|date| ...} â self
Instance Public methods

Iterates evaluation of the given block, which takes a date object. The limit should be a date object.

Date.new(2001).step(Date.new(2001,-1,-1)).select{|d| d.sunday?}.size
                          #=> 52
doc_ruby_on_rails
2015-04-02 15:41:44
Comments
Leave a Comment

Please login to continue.