--Multipart_Thu_Apr__6_13:27:07_2000-1
Content-Type: text/plain; charset=US-ASCII

GOTO Kentaro writes:
> Hi,

Hi gotoken,

again you have done a fine piece of work! Playing with it I have found
two, ehrm ..., quirks! But perhaps I have only misunderstood your
intention so please forgive me in that case.

Furthermore I have an 'improvement' proposal yet. Ehrm ... not a real
improvement, indeed. I want to propose to have following Exceptions:

   Crontab::Error < Exception
   Crontab::FormatError < Crontab::Error

If sometime in the future Crontab would be extend to e.g. write a
crontab file, all further exceptions could be assigned under
Crontab::Error then. So I would have the possibility to have a common
Crontab exception root.

Just a thought!

\cle

> 
> In message "[ruby-talk:02361] crontab"
>     on 00/04/05, Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes:
> >I want to have a program that may be run between certain times.
> >It seems silly to invent a format to specify the start and end times
> >when I can use that from crontab.  So, has anyone already produced
> >code that will tell if "now" matches a crontab entry, using Ruby?
> 
> I've wrote. How about?
> 
> http://www.math.sci.hokudai.ac.jp/~gotoken/ruby/p/crontab/
> 
> -- gotoken


--Multipart_Thu_Apr__6_13:27:07_2000-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="crontab.patch"
Content-Transfer-Encoding: quoted-printable

*** crontab/crontab.rb	Wed Apr  5 20:05:55 2000
--- ./crontab.rb	Thu Apr  6 13:02:23 2000
***************
*** 8,14 ****
  equire "crontab"
  ab = Crontab.new("/var/cron/tabs/" + ENV('USER'))
  ab = Crontab.new
    tab.add("5,35 0-23/2 * * *"){system "a_program"}
--- 8,14 ----
  equire "crontab"
  ab = Crontab.open("/var/cron/tabs/" + ENV['USER'])
  ab = Crontab.new
    tab.add("5,35 0-23/2 * * *"){system "a_program"}
***************
*** 100,106 ****
  ef add(str, job = nil)
      job = proc if iterator?
!     @table.push((parse_timedate(str) + job).extend CronRecord)
    end
  ttr_reader :table
--- 100,106 ----
  ef add(str, job = nil)
      job = proc if iterator?
!     @table.push((parse_timedate(str) << job).extend CronRecord)
    end
  ttr_reader :table
***************
*** 199,205 ****
  DAY = %w(sun mon tue wed thu fri sut)
  lass FormatError < Exception; end
  end
  f __FILE__ == $0
--- 199,206 ----
  DAY = %w(sun mon tue wed thu fri sut)
  lass Error < Exception; end
!   class FormatError < Error; end
  end
  f __FILE__ == $0

--Multipart_Thu_Apr__6_13:27:07_2000-1
Content-Type: text/plain; charset=US-ASCII



--Multipart_Thu_Apr__6_13:27:07_2000-1--