The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Time.today going away

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Hodel

Posts: 660
Nickname: drbrain
Registered: Mar, 2006

Eric Hodel is a long-time Rubyist and co-founder of Seattle.rb.
Time.today going away Posted: Oct 8, 2007 3:59 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Hodel.
Original Post: Time.today going away
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Hodel
Latest Posts From Segment7

Advertisement

So you’ve been using Time::today for some time, and thought it was part of time.rb or ActiveSupport? Well, you’d be wrong. I was!

It turns out that rubygems/specification.rb defines Time::today, and that’s wrong. RubyGems has no business adding methods to the core when it doesn’t need to, so I’ve marked it for removal.

If you want to use Time::today in the future you’ll need to define it in your code somewhere, here is its definition:

require 'time'

def Time.today
  Time.parse Time.now.strftime("%Y-%m-%d")
end unless Time.respond_to? :today

Go ahead and throw it in wherever you think is appropriate. I suggest you do this now.

Read: Time.today going away

Topic: Chad Fowler's Dirty Little Secret? Previous Topic   Next Topic Topic: Are you nuts or stupid? Nevermind, I know the answer to that.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use