Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 824

Show
Ignore:
Timestamp:
03/02/05 13:07:02 (4 years ago)
Author:
david
Message:

Added String#to_time and String#to_date for wrapping ParseDate

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/CHANGELOG

    r796 r824  
     1*SVN* 
     2 
     3* Added String#to_time and String#to_date for wrapping ParseDate 
     4 
     5 
    16*1.0.0* (24th February, 2005) 
    27 
  • trunk/activesupport/lib/active_support/core_ext/string.rb

    r624 r824  
    11require File.dirname(__FILE__) + '/string/inflections' 
     2require File.dirname(__FILE__) + '/string/conversions' 
    23 
    34class String #:nodoc: 
    45  include ActiveSupport::CoreExtensions::String::Inflections 
     6  include ActiveSupport::CoreExtensions::String::Conversions 
    57end 
  • trunk/activesupport/test/core_ext/string_ext_test.rb

    r624 r824  
    6262    end 
    6363  end 
     64   
     65  def test_string_to_time 
     66    assert_equal Time.utc(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time 
     67    assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time(:local) 
     68    assert_equal Date.new(2005, 2, 27), "2005-02-27".to_date 
     69  end 
    6470end