Skip to content

Commit

Permalink
Merge pull request #21103 from mikeastock/update_time_advance_docs
Browse files Browse the repository at this point in the history
Update Time#advance documentation with examples [ci skip]
  • Loading branch information
senny committed Aug 3, 2015
2 parents 31ee9c0 + 3d03850 commit ca8f3ca
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -108,6 +108,12 @@ def change(options)
# takes a hash with any of these keys: <tt>:years</tt>, <tt>:months</tt>,
# <tt>:weeks</tt>, <tt>:days</tt>, <tt>:hours</tt>, <tt>:minutes</tt>,
# <tt>:seconds</tt>.
#
# Time.new(2015, 8, 1, 14, 35, 0).advance(seconds: 1) # => 2015-08-01 14:35:01 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(minutes: 1) # => 2015-08-01 14:36:00 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(hours: 1) # => 2015-08-01 15:35:00 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(days: 1) # => 2015-08-02 14:35:00 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(weeks: 1) # => 2015-08-08 14:35:00 -0700
def advance(options)
unless options[:weeks].nil?
options[:weeks], partial_weeks = options[:weeks].divmod(1)
Expand Down

0 comments on commit ca8f3ca

Please sign in to comment.