Wednesday, March 25, 2009

Hebruby ...

Ok, on the very first day that I was keen to try Hebruby
... today ... 2009-3-25 ... it's broken.
$ cat foo.rb
require 'rubygems'
require 'hebruby'

# the 24th
@day = Date.new(2009, 3, 24)
@hb = Hebruby::HebrewDate.new(@day)
puts @day.to_s + " = " + @hb.heb_date

# the 26th
@day = Date.new(2009, 3, 26)
@hb = Hebruby::HebrewDate.new(@day)
puts @day.to_s + " = " + @hb.heb_date

# the 25th ???
@day = Date.new(2009, 3, 25)
@hb = Hebruby::HebrewDate.new(@day)
puts @day.to_s + " = " + @hb.heb_date
Seems simple enough, right? I mean Hebruby is in the current list of gems today, and it's not like we change the calendaring system everyday.
# gem list Hebruby --details --remote

Hebruby (1.2.1)
Author: Ron Evans
Homepage: http://www.deadprogrammersociety.com

Hebruby is a Ruby library to convert julian dates to hebrew dates,
and vice-versa.
You cant make this stuff up.
$ ruby foo.rb
2009-03-24 = כ"ז באדר התשס"ט
2009-03-26 = א' בניסן התשס"ט
/usr/lib/ruby/gems/1.8/gems/Hebruby-1.2.1/lib/hebruby.rb:101:in `heb_date': undefined method `+' for nil:NilClass (NoMethodError)
from foo.rb:17
$
I guess there is no word in Hebrew for "coincidence"?

5 comments:

Ron Evans said...

Ouch! Sounds like I need to take a look at the Hebruby gem. It has not been updated in a while, but since the Hebrew calendar has not changed in the last few thousand years, that should not be allowed!

Vernon Singleton said...

Thanks. I tried to email you before blogging about it, but did not get a reply. Feel free to email me if you'd like this post removed or whatever after it's fixed.

Ron Evans said...

No need to remove posts, I can live with reality. :) However, perhaps you can update this once I see what the problem is.

I have just moved the code over to Github at http://github.com/deadprogrammer/hebruby/tree/master so that should make it easier to work on, both individually and collectively.

Vernon Singleton said...

So I finally got around to trying this again with version 2.0.2 and it worked as follows:

$ ruby foo.rb
2009-03-24 = כ"ז באדר התשס"ט
2009-03-26 = א' בניסן התשס"ט
2009-03-25 = כ"ט באדר התשס"ט

Thanks, Ron.

So it is functional, if only I could verify that the Hebrew dates are correct.

Pixelated Dwarf said...

Is there a way to get it to print out the Torah Portions and the Holidays? I was using HebCal (Written in C) on PHP pages but I am switching the site over to Rails and wondered how to do that.

Thanks for the Gem.