<commit_before># Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.
# Written by <NAME> (ron dot evans at gmail dot com or http://www.deadprogrammersociety.com).
# Additional code contributed by <NAME>.
# Based on Javascript code from <NAME> (http://www.fourmilab.ch/documents/calendar/).
# Usage:      
#       For julian to hebrew:
#             @hb = Hebruby::HebrewDate.new(Date.new(2010, 1, 1))
#             assert_equal(10, @hb.month, "Wrong month.")
#             assert_equal("Tevet", @hb.month_name, "Wrong month name.")
#             assert_equal(5770, @hb.year, "Wrong year.")
#             assert_equal(15, @hb.day, "Wrong day.")
#
#       For hebrew to julian:
#             @hb = Hebruby::HebrewDate.new1(15,10,5770)
#             assert_equal(Date.new(2010, 1, 1).jd, @hb.jd, "Wrong Julian date.")

require 'jcode'
$KCODE = 'u' # Always use UTF-8 internally!

module Hebruby

  class HebrewDate
    HEBREW_EPOCH = 347995
    MONTH_NAMES = %w{none Nissan Iyar Sivan Tamuz Av Elul Tishrei Chesvan Kislev Tevet Shvat Adar Veadar}
    HEB_MONTH_NAMES = [ nil, 'ניסן', 'אייר', 'סיון', 'תמוז', 'אב', 'אלול', 'תשרי', 
      'חשון', 'כסלו', 'טבת', 'שבט', 'אדר', 'אדר א\'', 'אדר ב\'']
    HEB_DAYS = [ nil, 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'ז\'', 'ח\'', 'ט\'', 
      'י\'', 'י"א', 'י"ב', 'י"ג', 'י"ד', 'ט"ו', 'ט"ז', 'י"ז', 'י"ח', 'י"ח', 
      'י"ט', 'כ\'' , 'כ"א', 'כ"ב', 'כ"ג', 'כ"ד', 'כ"ה', 'כ"ו', 'כ"ז', 'כ"ט', 'ל\'' ]
     ONES = [ '', 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט' ]
    TENS = [ '', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ' ] 


    # Accessors for base Hebrew day, month, and year
   attr_accessor :hd, :hm, :hy
    
   # Constructor.
   # When passed 1 parameter, the one parameter must either be an integer
   # representing a Julian day number, or some kind of date object (e.g. Ruby's
   # Date class) that responds to the +jd+ method to expose a Julian day
   # number.
   # When passed 3 parameters, they are +day+,+month+,+year+ of the
   # Hebrew date, as integers.
   def initialize(*params)
     if params.size == 3
       @hd = params[0]
       @hm = params[1]
       @hy = params[2]
       convert_from_hebrew
     elsif params.size == 1
       jd=params[0]
       if jd
         if jd.is_a? Integer
           @jd = jd
         elsif jd.respond_to? :jd
           @jd = jd.jd
         end
         convert_from_julian
       end<commit_msg>Fix a missing ArgumentError in the constructor<commit_after># Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.
# Written by <NAME> (ron dot evans at gmail dot com or http://www.deadprogrammersociety.com).
# Additional code contributed by <NAME>.
# Based on Javascript code from <NAME> (http://www.fourmilab.ch/documents/calendar/).
# Usage:      
#       For julian to hebrew:
#             @hb = Hebruby::HebrewDate.new(Date.new(2010, 1, 1))
#             assert_equal(10, @hb.month, "Wrong month.")
#             assert_equal("Tevet", @hb.month_name, "Wrong month name.")
#             assert_equal(5770, @hb.year, "Wrong year.")
#             assert_equal(15, @hb.day, "Wrong day.")
#
#       For hebrew to julian:
#             @hb = Hebruby::HebrewDate.new1(15,10,5770)
#             assert_equal(Date.new(2010, 1, 1).jd, @hb.jd, "Wrong Julian date.")

require 'jcode'
$KCODE = 'u' # Always use UTF-8 internally!

module Hebruby

  class HebrewDate
    HEBREW_EPOCH = 347995
    MONTH_NAMES = %w{none Nissan Iyar Sivan Tamuz Av Elul Tishrei Chesvan Kislev Tevet Shvat Adar Veadar}
    HEB_MONTH_NAMES = [ nil, 'ניסן', 'אייר', 'סיון', 'תמוז', 'אב', 'אלול', 'תשרי', 
      'חשון', 'כסלו', 'טבת', 'שבט', 'אדר', 'אדר א\'', 'אדר ב\'']
    HEB_DAYS = [ nil, 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'ז\'', 'ח\'', 'ט\'', 
      'י\'', 'י"א', 'י"ב', 'י"ג', 'י"ד', 'ט"ו', 'ט"ז', 'י"ז', 'י"ח', 'י"ח', 
      'י"ט', 'כ\'' , 'כ"א', 'כ"ב', 'כ"ג', 'כ"ד', 'כ"ה', 'כ"ו', 'כ"ז', 'כ"ט', 'ל\'' ]
     ONES = [ '', 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט' ]
    TENS = [ '', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ' ] 


    # Accessors for base Hebrew day, month, and year
   attr_accessor :hd, :hm, :hy
    
   # Constructor.
   # When passed 1 parameter, the one parameter must either be an integer
   # representing a Julian day number, or some kind of date object (e.g. Ruby's
   # Date class) that responds to the +jd+ method to expose a Julian day
   # number.
   # When passed 3 parameters, they are +day+,+month+,+year+ of the
   # Hebrew date, as integers.
   def initialize(*params)
     if params.size == 3
       @hd = params[0]
       @hm = params[1]
       @hy = params[2]
       convert_from_hebrew
     elsif params.size == 1
       jd=params[0]
       if jd
         if jd.is_a? Integer
           @jd = jd
         elsif jd.respond_to? :jd
           @jd = jd.jd
         else
           raise ArgumentError
         end
         convert_from_julian
       end
{'fraction_non_alphanumeric': 0.18532035685320356, 'fraction_numerical': 0.017842660178426603, 'mean_word_length': 2.5185449358059913, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5747229', 'n_tokens_mistral': 2056, 'n_tokens_neox': 1963, 'n_words': 554}