hebruby 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e46bcc4daaea6483cee52df2b9d976a7df1a30d6
4
+ data.tar.gz: f380e12e76b02bc75a1e14516755125719535093
5
+ SHA512:
6
+ metadata.gz: 23642d49ce991cc2fabd208ba6663937aac1c68d78933c5514eac28d74730975a8571abd9f5fb960286255ffb10700c29eacc759ecc6a6d9a1f0f587c8e82e5b
7
+ data.tar.gz: f3356e3a315494292a1564ecbb98f9ff8af2299e635097eab993bc17eb7ac5ee8a95eccb85f496e3abba4b7d5caa9226355334b170eca13d7de1240def35e34f
@@ -4,7 +4,7 @@
4
4
  # Written by Ron Evans (ron dot evans at gmail dot com or http://www.deadprogrammersociety.com).
5
5
  # Additional code contributed by Joshua Harvey.
6
6
  # Based on Javascript code from John Walker (http://www.fourmilab.ch/documents/calendar/).
7
- # Usage:
7
+ # Usage:
8
8
  # For julian to hebrew:
9
9
  # @hb = Hebruby::HebrewDate.new(Date.new(2010, 1, 1))
10
10
  # assert_equal(10, @hb.month, "Wrong month.")
@@ -22,23 +22,24 @@ if not "".respond_to?(:each_char)
22
22
  $KCODE = 'u' # Always use UTF-8 internally!
23
23
  end
24
24
 
25
+ require "date"
25
26
  module Hebruby
26
27
 
27
28
  class HebrewDate
28
29
  HEBREW_EPOCH = 347995
29
30
  MONTH_NAMES = %w{none Nissan Iyar Sivan Tamuz Av Elul Tishrei Chesvan Kislev Tevet Shvat Adar} + ["Adar Sheni"]
30
- HEB_MONTH_NAMES = [ nil, 'ניסן', 'אייר', 'סיון', 'תמוז', 'אב', 'אלול', 'תשרי',
31
+ HEB_MONTH_NAMES = [ nil, 'ניסן', 'אייר', 'סיון', 'תמוז', 'אב', 'אלול', 'תשרי',
31
32
  'חשון', 'כסלו', 'טבת', 'שבט', 'אדר', 'אדר א\'', 'אדר ב\'']
32
- HEB_DAYS = [ nil, 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'ז\'', 'ח\'', 'ט\'',
33
- 'י\'', 'י"א', 'י"ב', 'י"ג', 'י"ד', 'ט"ו', 'ט"ז', 'י"ז', 'י"ח', 'י"ח',
33
+ HEB_DAYS = [ nil, 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'ז\'', 'ח\'', 'ט\'',
34
+ 'י\'', 'י"א', 'י"ב', 'י"ג', 'י"ד', 'ט"ו', 'ט"ז', 'י"ז', 'י"ח', 'י"ח',
34
35
  'י"ט', 'כ\'' , 'כ"א', 'כ"ב', 'כ"ג', 'כ"ד', 'כ"ה', 'כ"ו', 'כ"ז', 'כ"ט', 'ל\'' ]
35
36
  ONES = [ '', 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט' ]
36
- TENS = [ '', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ' ]
37
+ TENS = [ '', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ' ]
37
38
 
38
39
 
39
40
  # Accessors for base Hebrew day, month, and year
40
41
  attr_accessor :hd, :hm, :hy
41
-
42
+
42
43
  # Constructor.
43
44
  # When passed 1 parameter, the one parameter must either be an integer
44
45
  # representing a Julian day number, or some kind of date object (e.g. Ruby's
@@ -68,7 +69,7 @@ module Hebruby
68
69
  raise ArgumentError
69
70
  end
70
71
  end
71
-
72
+
72
73
  def day
73
74
  return @hd
74
75
  end
@@ -87,7 +88,7 @@ module Hebruby
87
88
  def jd
88
89
  return @jd
89
90
  end
90
-
91
+
91
92
  # Provide Hebrew month name transiterated into Englsih
92
93
  def month_name
93
94
  return MONTH_NAMES[@hm]
@@ -121,13 +122,18 @@ module Hebruby
121
122
  return heb_day_name + " ב" + heb_month_name + " " + heb_year_name
122
123
  end
123
124
 
125
+ # return Ruby `Date` object
126
+ def julian_date
127
+ return Date.jd(@jd)
128
+ end
129
+
124
130
  # Return the representation in hebrew letters for a number less than 100
125
131
  def self.heb_number(num)
126
132
  raise ArgumentError if num>100 or num < 0
127
133
  return 'ט"ו' if num == 15
128
134
  return 'ט"ז' if num == 16
129
135
  if num < 10
130
- return '"' + ONES[ num % 10 ]
136
+ return '"' + ONES[ num % 10 ]
131
137
  elsif num % 10 == 0
132
138
  return '"' + TENS[ num / 10 ]
133
139
  else
@@ -169,7 +175,7 @@ module Hebruby
169
175
  # Similarly, Kislev varies with the length of year
170
176
  when (month == 9 && (year_days(year).modulo(10) == 3)) then
171
177
  return 29
172
-
178
+
173
179
  # Nope, it's a 30 day month
174
180
  else
175
181
  return 30
@@ -179,11 +185,11 @@ module Hebruby
179
185
  # internal conversion method to keep fields syncronized with julian day number
180
186
  def convert_from_julian
181
187
  dateArray = HebrewDate.jd_to_hebrew(@jd)
182
- @hy = dateArray[0]
183
- @hm = dateArray[1]
184
- @hd = dateArray[2]
188
+ @hy = dateArray[0]
189
+ @hm = dateArray[1]
190
+ @hd = dateArray[2]
185
191
  end
186
-
192
+
187
193
  # internal conversion method to keep fields syncronized with julian day number
188
194
  def convert_from_hebrew
189
195
  @jd = HebrewDate.to_jd(@hy, @hm, @hd)
@@ -226,7 +232,7 @@ module Hebruby
226
232
  months = year_months(year)
227
233
 
228
234
  jd = day
229
-
235
+
230
236
  if (month < 7) then
231
237
  for mon in 7..months
232
238
  jd += month_days(year, mon)
@@ -240,7 +246,7 @@ module Hebruby
240
246
  jd += month_days(year, mon)
241
247
  end
242
248
  end
243
-
249
+
244
250
  jd += days_in_prior_years(year)
245
251
 
246
252
  return jd
@@ -255,7 +261,7 @@ module Hebruby
255
261
  day = greg_date.mday
256
262
  year = 3760 + greg_date.year
257
263
 
258
- year += 1 while jd >= to_jd(year + 1, 7, 1)
264
+ year += 1 while jd >= to_jd(year + 1, 7, 1)
259
265
  length = year_months(year)
260
266
  month = (1 + month % length) while jd > to_jd(year,month,month_days(year,month))
261
267
 
metadata CHANGED
@@ -1,83 +1,44 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hebruby
3
- version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 4
10
- version: 2.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Ron Evans
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-06-25 00:00:00 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
- description: Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.
22
- email: ""
13
+ description: Convert Hebrew dates to/from Julian dates
14
+ email: nick@quaran.to
23
15
  executables: []
24
-
25
16
  extensions: []
26
-
27
- extra_rdoc_files:
28
- - CHANGELOG
29
- - LICENSE
30
- - README
31
- - README.rdoc
17
+ extra_rdoc_files: []
18
+ files:
32
19
  - lib/hebruby.rb
33
- files:
34
- - CHANGELOG
35
- - LICENSE
36
- - Manifest
37
- - README
38
- - README.rdoc
39
- - Rakefile
40
- - lib/hebruby.rb
41
- - test/hebruby_tests.rb
42
- - hebruby.gemspec
43
- homepage: http://deadprogrammersociety.com/
44
- licenses: []
45
-
46
- post_install_message: "*** Hebruby was installed ***"
47
- rdoc_options:
48
- - --line-numbers
49
- - --inline-source
50
- - --title
51
- - Hebruby
52
- - --main
53
- - README
54
- require_paths:
20
+ homepage: http://rubygems.org/gems/hebruby
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
55
27
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
59
30
  - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
65
- required_rubygems_version: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
68
35
  - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 11
71
- segments:
72
- - 1
73
- - 2
74
- version: "1.2"
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
75
38
  requirements: []
76
-
77
- rubyforge_project: hebruby
78
- rubygems_version: 1.8.5
39
+ rubyforge_project:
40
+ rubygems_version: 2.4.6
79
41
  signing_key:
80
- specification_version: 3
81
- summary: Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.
42
+ specification_version: 4
43
+ summary: Convert Hebrew dates to/from Julian dates
82
44
  test_files: []
83
-
data/CHANGELOG DELETED
@@ -1,10 +0,0 @@
1
- v2.0.4 Handle Jewish leap year thanks to Uri Lewin
2
-
3
- v2.0.3 Change to transliterated month name to Adar Sheni
4
-
5
- v2.0.2 Minor tweaks for Ruby 1.9 compatibility
6
-
7
- v2.0.1 Add Echoe to make publishing gem to RubyForge easier
8
-
9
- v2.0.0 Total rewrite of algorithm thanks to kbloom
10
-
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2005-2011 Ron Evans
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest DELETED
@@ -1,8 +0,0 @@
1
- CHANGELOG
2
- LICENSE
3
- Manifest
4
- README
5
- README.rdoc
6
- Rakefile
7
- lib/hebruby.rb
8
- test/hebruby_tests.rb
data/README DELETED
@@ -1,6 +0,0 @@
1
- # Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.
2
- # Written by Ron Evans (ron dot evans at gmail dot com or http://www.deadprogrammersociety.com).
3
- # Additional code contributed by Joshua Harvey.
4
- # Algorithm rewritten by Ken Bloom (kbloom@gmail.com) # based on ``Calendrical
5
- # Calculations'' by Nachum Dershowitz and Edward M. Reingold, Cambridge
6
- # University Press (1997), as implemented in emacs' lisp/calendar/cal-hebrew.el
@@ -1,29 +0,0 @@
1
- = Hebruby
2
-
3
- Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.
4
-
5
- Written by Ron Evans (ron dot evans at gmail dot com or http://www.deadprogrammersociety.com).
6
-
7
- Additional code contributed by Joshua Harvey.
8
-
9
- Algorithm rewritten by Ken Bloom (kbloom@gmail.com) based on 'Calendrical Calculations' by Nachum Dershowitz and Edward M. Reingold, Cambridge University Press (1997), as implemented in emacs' lisp/calendar/cal-hebrew.el
10
-
11
- = How to install
12
-
13
- sudo gem install hebruby
14
-
15
- = How to use:
16
-
17
- require 'rubygems'
18
- require 'hebruby'
19
-
20
- @hb = Hebruby::HebrewDate.new(2,4,5728)
21
- puts @hb.day # => 2
22
- puts @hb.month # => 4
23
- puts @hb.month_name # => Tamuz
24
- puts @hb.heb_month_name # => תמוז
25
- puts @hb.year # => 5728
26
- puts @hb.heb_year_name # => התשכ"ח
27
- puts @hb.jd # => 6/28/1968
28
-
29
-
data/Rakefile DELETED
@@ -1,26 +0,0 @@
1
- require 'rubygems'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
- require 'echoe'
5
-
6
- task :default => :test
7
-
8
- Rake::RDocTask.new do |rd|
9
- rd.main = "README.rdoc"
10
- rd.rdoc_files += ["README.rdoc"]
11
- rd.rdoc_files += Dir.glob("lib/**/*.rb")
12
- rd.rdoc_dir = 'doc'
13
- end
14
-
15
- Rake::TestTask.new do |t|
16
- t.pattern = File.dirname(__FILE__) + "/test/*_tests.rb"
17
- end
18
-
19
- Echoe.new("hebruby") do |p|
20
- p.author = "Ron Evans"
21
- p.summary = "Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa."
22
- p.url = "http://deadprogrammersociety.com/"
23
- p.install_message = "*** Hebruby was installed ***"
24
- p.include_rakefile = true
25
- end
26
-
@@ -1,30 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{hebruby}
5
- s.version = "2.0.4"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{Ron Evans}]
9
- s.date = %q{2011-06-25}
10
- s.description = %q{Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.}
11
- s.email = %q{}
12
- s.extra_rdoc_files = [%q{CHANGELOG}, %q{LICENSE}, %q{README}, %q{README.rdoc}, %q{lib/hebruby.rb}]
13
- s.files = [%q{CHANGELOG}, %q{LICENSE}, %q{Manifest}, %q{README}, %q{README.rdoc}, %q{Rakefile}, %q{lib/hebruby.rb}, %q{test/hebruby_tests.rb}, %q{hebruby.gemspec}]
14
- s.homepage = %q{http://deadprogrammersociety.com/}
15
- s.post_install_message = %q{*** Hebruby was installed ***}
16
- s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Hebruby}, %q{--main}, %q{README}]
17
- s.require_paths = [%q{lib}]
18
- s.rubyforge_project = %q{hebruby}
19
- s.rubygems_version = %q{1.8.5}
20
- s.summary = %q{Hebruby is a Ruby library to convert julian dates to hebrew dates, and vice-versa.}
21
-
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 3
24
-
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- else
27
- end
28
- else
29
- end
30
- end
@@ -1,208 +0,0 @@
1
- # coding:utf-8
2
-
3
- # Unit tests for Hebruby module to convert julian dates to hebrew dates, and vice-versa
4
- # Written by Ron Evans
5
- # Additional code contributed by Joshua Harvey
6
- # Based on Javascript code from John Walker (http://www.fourmilab.ch/documents/calendar/)
7
- require 'test/unit'
8
- require File.dirname(__FILE__)+'/../lib/hebruby'
9
- require 'date'
10
-
11
- class TC_MyTest2 < Test::Unit::TestCase
12
- # def setup
13
- # end
14
-
15
- # def teardown
16
- # end
17
-
18
- #
19
- # hebrew to julian tests
20
- #
21
-
22
- def test_h2j_1
23
- @hb = Hebruby::HebrewDate.new(Date.new(2010, 1, 1))
24
- assert_equal(10, @hb.month, "Wrong month.")
25
- assert_equal("Tevet", @hb.month_name, "Wrong month name.")
26
- assert_equal(5770, @hb.year, "Wrong year.")
27
- assert_equal(15, @hb.day, "Wrong day.")
28
- end
29
-
30
- def test_h2j_2
31
- @hb = Hebruby::HebrewDate.new(Date.new(2005, 1, 15))
32
- assert_equal(11, @hb.month, "Wrong month.")
33
- assert_equal("Shvat", @hb.month_name, "Wrong month name.")
34
- assert_equal(5765, @hb.year, "Wrong year.")
35
- assert_equal(5, @hb.day, "Wrong day.")
36
- end
37
-
38
- def test_h2j_3
39
- @hb = Hebruby::HebrewDate.new(Date.new(2005, 4, 10))
40
- assert_equal(1, @hb.day, "Wrong day.")
41
- assert_equal(1, @hb.month, "Wrong month.")
42
- assert_equal("Nissan", @hb.month_name, "Wrong month name.")
43
- assert_equal(5765, @hb.year, "Wrong year.")
44
- end
45
-
46
- def test_h2j_4
47
- @hb = Hebruby::HebrewDate.new(Date.new(1966, 4, 10))
48
- assert_equal(1, @hb.month, "Wrong month.")
49
- assert_equal("Nissan", @hb.month_name, "Wrong month name.")
50
- assert_equal(5726, @hb.year, "Wrong year.")
51
- assert_equal(20, @hb.day, "Wrong day.")
52
- end
53
-
54
- #using the same date as the previous test, this time we pass
55
- #an integer rather than a Date object
56
- def test_julianday_integer
57
- @hb = Hebruby::HebrewDate.new(Date.new(1966, 4, 10).jd)
58
- assert_equal(1, @hb.month, "Wrong month.")
59
- assert_equal("Nissan", @hb.month_name, "Wrong month name.")
60
- assert_equal(5726, @hb.year, "Wrong year.")
61
- assert_equal(20, @hb.day, "Wrong day.")
62
- end
63
-
64
- def test_h2j_5
65
- @hb = Hebruby::HebrewDate.new(Date.new(1998, 12, 22))
66
- assert_equal(10, @hb.month, "Wrong month.")
67
- assert_equal("Tevet", @hb.month_name, "Wrong month name.")
68
- assert_equal(5759, @hb.year, "Wrong year.")
69
- assert_equal(3, @hb.day, "Wrong day.")
70
- end
71
-
72
- def test_h2j_6
73
- @hb = Hebruby::HebrewDate.new(Date.new(1968, 6, 28))
74
- assert_equal(4, @hb.month, "Wrong month.")
75
- assert_equal("Tamuz", @hb.month_name, "Wrong month name.")
76
- assert_equal(5728, @hb.year, "Wrong year.")
77
- assert_equal(2, @hb.day, "Wrong day.")
78
- end
79
-
80
- def test_h2j_7
81
- @hb = Hebruby::HebrewDate.new(Date.new(1941, 12, 10))
82
- assert_equal(9, @hb.month, "Wrong month.")
83
- assert_equal("Kislev", @hb.month_name, "Wrong month name.")
84
- assert_equal(5702, @hb.year, "Wrong year.")
85
- assert_equal(20, @hb.day, "Wrong day.")
86
- end
87
-
88
- #Test the 30th of a 30-day month
89
- def test_h2j_8
90
- @hb = Hebruby::HebrewDate.new(Date.new(2009, 4, 24))
91
- assert_equal(1, @hb.month, "Wrong month.")
92
- assert_equal("Nissan", @hb.month_name, "Wrong month name.")
93
- assert_equal(5769, @hb.year, "Wrong year.")
94
- assert_equal(30, @hb.day, "Wrong day.")
95
- end
96
- #
97
- #Test the 29th of a 29-day month
98
- def test_h2j_9
99
- @hb = Hebruby::HebrewDate.new(Date.new(2008, 1, 7))
100
- assert_equal(10, @hb.month, "Wrong month.")
101
- assert_equal("Tevet", @hb.month_name, "Wrong month name.")
102
- assert_equal(5768, @hb.year, "Wrong year.")
103
- assert_equal(29, @hb.day, "Wrong day.")
104
- end
105
-
106
- def test_h2j_10
107
- @hb = Hebruby::HebrewDate.new(Date.new(2005, 3, 18))
108
- assert_equal(13, @hb.month, "Wrong month.")
109
- assert_equal("Adar Sheni", @hb.month_name, "Wrong month name.")
110
- assert_equal(5765, @hb.year, "Wrong year.")
111
- assert_equal(7, @hb.day, "Wrong day.")
112
- end
113
-
114
- def test_jd
115
- orig=2454946
116
-
117
- assert_equal(orig,Hebruby::HebrewDate.to_jd(*
118
- Hebruby::HebrewDate.jd_to_hebrew(orig)),
119
- "Julian day number #{orig} didn't make a round trip using class methods")
120
-
121
- hb=Hebruby::HebrewDate.new(orig)
122
- hb.convert_from_julian
123
- hb.convert_from_hebrew
124
- assert_equal(orig,hb.jd,
125
- "Julian day number #{orig} didn't make a round trip using instance methods")
126
- end
127
-
128
- def test_to_jd
129
- assert_equal(2454944,Hebruby::HebrewDate.to_jd(5769,1,28))
130
- assert_equal(2454945,Hebruby::HebrewDate.to_jd(5769,1,29))
131
- assert_equal(2454946,Hebruby::HebrewDate.to_jd(5769,1,30))
132
- end
133
-
134
- #
135
- # julian to hebrew tests
136
- #
137
-
138
- def test_j2h_1
139
- @hb = Hebruby::HebrewDate.new(15,10,5770)
140
- assert_equal(15, @hb.day, "Wrong day.")
141
- assert_equal(10, @hb.month, "Wrong month.")
142
- assert_equal("Tevet", @hb.month_name, "Wrong month name.")
143
- assert_equal(5770, @hb.year, "Wrong year.")
144
- assert_equal('התש"ע', @hb.heb_year_name, "Wrong year.")
145
- assert_equal(Date.new(2010, 1, 1).jd, @hb.jd, "Wrong Julian date.")
146
- end
147
-
148
- def test_j2h_2
149
- @hb = Hebruby::HebrewDate.new(5,11,5765)
150
- assert_equal(5, @hb.day, "Wrong day.")
151
- assert_equal(11, @hb.month, "Wrong month.")
152
- assert_equal("Shvat", @hb.month_name, "Wrong month name.")
153
- assert_equal(5765, @hb.year, "Wrong year.")
154
- assert_equal(Date.new(2005, 1, 15).jd, @hb.jd, "Wrong Julian date.")
155
- end
156
-
157
- def test_j2h_3
158
- @hb = Hebruby::HebrewDate.new(1,1,5765)
159
- assert_equal(1, @hb.day, "Wrong day.")
160
- assert_equal(1, @hb.month, "Wrong month.")
161
- assert_equal("Nissan", @hb.month_name, "Wrong month name.")
162
- assert_equal(5765, @hb.year, "Wrong year.")
163
- assert_equal(Date.new(2005, 4, 10).jd, @hb.jd, "Wrong Julian date.")
164
- end
165
-
166
- def test_j2h_4
167
- @hb = Hebruby::HebrewDate.new(20,1,5726)
168
- assert_equal(20, @hb.day, "Wrong day.")
169
- assert_equal(1, @hb.month, "Wrong month.")
170
- assert_equal(5726, @hb.year, "Wrong year.")
171
- assert_equal("Nissan", @hb.month_name, "Wrong month name.")
172
- assert_equal(Date.new(1966, 4, 10).jd, @hb.jd, "Wrong Julian date.")
173
- end
174
-
175
- def test_j2h_5
176
- @hb = Hebruby::HebrewDate.new(3,10,5759)
177
- assert_equal(3, @hb.day, "Wrong day.")
178
- assert_equal(10, @hb.month, "Wrong month.")
179
- assert_equal("Tevet", @hb.month_name, "Wrong month name.")
180
- assert_equal(5759, @hb.year, "Wrong year.")
181
- assert_equal(Date.new(1998, 12, 22).jd, @hb.jd, "Wrong Julian date.")
182
- assert_equal(%q{ג' בטבת התשנ"ט}, @hb.heb_date)
183
- end
184
-
185
- def test_j2h_6
186
- @hb = Hebruby::HebrewDate.new(2,4,5728)
187
- assert_equal(2, @hb.day, "Wrong day.")
188
- assert_equal(4, @hb.month, "Wrong month.")
189
- assert_equal("Tamuz", @hb.month_name, "Wrong month name.")
190
- assert_equal("תמוז", @hb.heb_month_name, "Wrong month name.")
191
- assert_equal(5728, @hb.year, "Wrong year.")
192
- assert_equal('התשכ"ח', @hb.heb_year_name, "Wrong year.")
193
- assert_equal(Date.new(1968, 6, 28).jd, @hb.jd, "Wrong Julian date.")
194
- end
195
-
196
- def test_j2h_7
197
- @hb = Hebruby::HebrewDate.new(20,9,5702)
198
- assert_equal(20, @hb.day, "Wrong day.")
199
- assert_equal(9, @hb.month, "Wrong month.")
200
- assert_equal("Kislev", @hb.month_name, "Wrong month name.")
201
- assert_equal("כסלו", @hb.heb_month_name, "Wrong month name.")
202
- assert_equal(5702, @hb.year, "Wrong year.")
203
- assert_equal('התש"ב', @hb.heb_year_name, "Wrong year.")
204
- assert_equal(Date.new(1941, 12, 10).jd, @hb.jd, "Wrong Julian date.")
205
- end
206
-
207
- end
208
-