Time Extensions plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install svn://svn.teksol.info/svn/rails/plugins/time_extensions
class TimeExtensionsTest < Test::Unit::TestCase def test_really_in_future assert 1.second.from_now.in_future? end def test_in_future_but_past assert !1.second.ago.in_future? end def test_really_in_past assert 1.second.ago.in_past? end def test_in_past_but_future assert !1.second.from_now.in_future? end end
This makes for much more readable code:
if @post.published_at.in_future? then # do something else # do something else end
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, 7 months ago

