Skip to content

Instantly share code, notes, and snippets.

@ches
Created February 12, 2013 15:34
Show Gist options
  • Select an option

  • Save ches/4770693 to your computer and use it in GitHub Desktop.

Select an option

Save ches/4770693 to your computer and use it in GitHub Desktop.
Date#step, a C method, does not like ActiveSupport::Duration
[2] pry(main)> Date.today.step(Date.tomorrow, 30.minutes).each { |time| puts time }
2013-02-12
TypeError: expected numeric
from (pry):2:in `step'
[3] pry(main)> show-source 30.minutes
From: /Users/ches/.rvm/gems/ruby-1.9.3-p327@REDACTED/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/time.rb @ line 39:
Owner: Numeric
Visibility: public
Number of lines: 3
def minutes
ActiveSupport::Duration.new(self * 60, [[:seconds, self * 60]])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment