Project

datify

0.0
No commit activity in last 3 years
No release in over 3 years
Datify is a rubygem to convert a string storing a date or a time in a proper Time ruby object
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.6.0
>= 0
~> 2.3.0
~> 0.6.0
 Project Readme

datify¶ ↑

Datify is a rubygem to convert a string storing a date or a time in a proper Time ruby object. Imagine you have a text file containing a list of string formatted this way ‘day-month-year’ and you want to have fulle featured Time object now you can with datify.

NEWS From the version 0.50 and beyond, you don’t have to call internal Datify::Engine methods anymore, but eventually you may want to use two new methods datify has added to String class.

If you require the datify gem, your strings will acquire:

is_time? - a boolean checking out if the string is a good datetime
to_time  - the core method returning a Time object for the self class

The API now is even easier.

"23-giu-1976".is_time? _~> true_
"23-giu-1976".to_time _1976-06-23 00:00:00 +0200_

Of course you can work in the previous way as well.

require 'datify'

my_date = Datify::Engine.new('16-giu-1976')
puts my_date.date.to_s

That’s it!

Install¶ ↑

You may want to install datify with the following command:

gem install datify

Contributing to datify¶ ↑

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Paolo Perego. See LICENSE.txt for further details.