No description, website, or topics provided.
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore first commit Oct 24, 2012
Gemfile first commit Oct 24, 2012
MIT-LICENSE added MIT-LICENSE and refactoring Oct 27, 2012
README.md changed README.md Oct 31, 2012
Rakefile
kronparser.gemspec

README.md

Kronparser

datermine next scheduled crontab run

Installation

Add this line to your application's Gemfile:

gem 'kronparser'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kronparser

Usage

  • Example1
require 'kronparser'
require 'time'

KronParser.parse("* * * * *").next(Time.parse("Fri Oct 26 11:27:44 +0900 2012"))
# => Fri Oct 26 11:28:00 +0900 2012
KronParser.parse("40 * * * *").prev(Time.parse("Fri Oct 26 11:27:44 +0900 2012"))
# => Fri Oct 26 10:40:00 +0900 2012
  • Example2
require 'kronparser'

KronParser.parse("* * * * *").next
# => Fri Oct 26 11:28:00 +0900 2012
# Default value is Time.now
  • Additional Example
gem 'kronparser'
require 'kronparser'

KronParser::SimpleProcess.every("* * * * *") do
  puts Time.now
end

while true
  sleep 10
end

# => Fri Oct 26 11:27:00 +0900 2012 
# => Fri Oct 26 11:28:00 +0900 2012
# => ...