diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-10-17 15:52:32 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-10-18 17:08:24 -0300 |
commit | b9fcce3944653db5eb49119c134e8525e91f7aee (patch) | |
tree | d7f52ceff25a8faf094ddd6a3ecaffde191d2280 /activesupport | |
parent | 7b71d8cfabe71dc9cf265809eed51e6956b60b7f (diff) | |
download | rails-b9fcce3944653db5eb49119c134e8525e91f7aee.tar.gz rails-b9fcce3944653db5eb49119c134e8525e91f7aee.tar.bz2 rails-b9fcce3944653db5eb49119c134e8525e91f7aee.zip |
Merge pull request #17302 from claudiob/replace-slower-block-call-with-faster-yield
Replace (slower) block.call with (faster) yield
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/testing/time_helpers.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/testing/time_helpers.rb b/activesupport/lib/active_support/testing/time_helpers.rb index 1112c6e0b1..8c63815660 100644 --- a/activesupport/lib/active_support/testing/time_helpers.rb +++ b/activesupport/lib/active_support/testing/time_helpers.rb @@ -90,7 +90,7 @@ module ActiveSupport # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 # end # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - def travel_to(date_or_time, &block) + def travel_to(date_or_time) if date_or_time.is_a?(Date) && !date_or_time.is_a?(DateTime) now = date_or_time.midnight.to_time else @@ -102,7 +102,7 @@ module ActiveSupport if block_given? begin - block.call + yield ensure travel_back end |