opal 0.9.0.beta2 → 0.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.jshintrc +2 -1
  3. data/.travis.yml +8 -4
  4. data/CHANGELOG.md +270 -251
  5. data/CONTRIBUTING.md +41 -0
  6. data/README.md +8 -8
  7. data/Rakefile +1 -1
  8. data/lib/opal/cli.rb +1 -0
  9. data/lib/opal/cli_options.rb +2 -2
  10. data/lib/opal/cli_runners.rb +1 -0
  11. data/lib/opal/cli_runners/nashorn.rb +58 -0
  12. data/lib/opal/cli_runners/phantom.js +11 -9
  13. data/lib/opal/compiler.rb +2 -0
  14. data/lib/opal/erb.rb +2 -1
  15. data/lib/opal/nodes/def.rb +15 -6
  16. data/lib/opal/nodes/helpers.rb +1 -1
  17. data/lib/opal/nodes/literal.rb +1 -1
  18. data/lib/opal/nodes/masgn.rb +79 -29
  19. data/lib/opal/nodes/module.rb +1 -1
  20. data/lib/opal/nodes/top.rb +6 -2
  21. data/lib/opal/parser.rb +1 -0
  22. data/lib/opal/parser/grammar.rb +3160 -3083
  23. data/lib/opal/parser/grammar.y +39 -11
  24. data/lib/opal/parser/lexer.rb +15 -13
  25. data/lib/opal/parser/sexp.rb +5 -0
  26. data/lib/opal/version.rb +1 -1
  27. data/opal/corelib/array.rb +21 -6
  28. data/opal/corelib/basic_object.rb +17 -4
  29. data/opal/corelib/class.rb +1 -1
  30. data/opal/corelib/constants.rb +2 -2
  31. data/opal/corelib/enumerator.rb +2 -0
  32. data/opal/corelib/hash.rb +50 -50
  33. data/opal/corelib/helpers.rb +1 -1
  34. data/opal/corelib/io.rb +9 -6
  35. data/opal/corelib/kernel.rb +37 -9
  36. data/opal/corelib/module.rb +6 -17
  37. data/opal/corelib/nil.rb +4 -0
  38. data/opal/corelib/number.rb +0 -4
  39. data/opal/corelib/runtime.js +637 -662
  40. data/opal/corelib/struct.rb +7 -3
  41. data/spec/filters/bugs/array.rb +4 -9
  42. data/spec/filters/bugs/basicobject.rb +1 -15
  43. data/spec/filters/bugs/date.rb +4 -26
  44. data/spec/filters/bugs/enumerable.rb +26 -1
  45. data/spec/filters/bugs/enumerator.rb +4 -4
  46. data/spec/filters/bugs/exception.rb +1 -7
  47. data/spec/filters/bugs/float.rb +14 -0
  48. data/spec/filters/bugs/hash.rb +0 -2
  49. data/spec/filters/bugs/integer.rb +1 -1
  50. data/spec/filters/bugs/kernel.rb +47 -66
  51. data/spec/filters/bugs/language.rb +1 -2
  52. data/spec/filters/bugs/module.rb +11 -14
  53. data/spec/filters/bugs/numeric.rb +3 -3
  54. data/spec/filters/bugs/proc.rb +0 -1
  55. data/spec/filters/bugs/range.rb +2 -3
  56. data/spec/filters/bugs/regexp.rb +15 -17
  57. data/spec/filters/bugs/set.rb +2 -2
  58. data/spec/filters/bugs/string.rb +29 -5
  59. data/spec/filters/bugs/{strscan.rb → stringscanner.rb} +9 -10
  60. data/spec/filters/bugs/struct.rb +0 -4
  61. data/spec/filters/bugs/time.rb +2 -3
  62. data/spec/filters/bugs/unboundmethod.rb +3 -0
  63. data/spec/filters/unsupported/freeze.rb +2 -1
  64. data/spec/filters/unsupported/taint.rb +2 -0
  65. data/spec/lib/parser/aref_spec.rb +10 -0
  66. data/spec/lib/parser/lambda_spec.rb +14 -0
  67. data/spec/lib/parser/op_asgn_spec.rb +17 -0
  68. data/spec/lib/parser/return_spec.rb +5 -0
  69. data/spec/lib/parser/unary_spec.rb +4 -0
  70. data/spec/lib/sprockets/erb_spec.rb +1 -1
  71. data/spec/mspec/opal/formatters.rb +159 -0
  72. data/{lib → spec}/mspec/opal/runner.rb +0 -160
  73. data/spec/opal/core/hash/internals_spec.rb +162 -162
  74. data/spec/opal/core/kernel/at_exit_spec.rb +70 -0
  75. data/spec/opal/core/kernel/extend_spec.rb +1 -1
  76. data/spec/opal/core/kernel/instance_variables_spec.rb +56 -0
  77. data/spec/opal/core/language/equal_spec.rb +8 -0
  78. data/spec/opal/core/language/predefined_spec.rb +1 -1
  79. data/spec/opal/core/language/ternary_operator_spec.rb +14 -0
  80. data/spec/opal/core/language/versions/{hash_1.9.rb → hash_1_9_spec.rb} +5 -0
  81. data/spec/opal/core/module/fixtures/classes.rb +11 -1
  82. data/spec/opal/core/module/method_lookup_spec.rb +13 -0
  83. data/spec/opal/core/runtime/super_spec.rb +10 -0
  84. data/spec/opal/stdlib/native/new_spec.rb +84 -0
  85. data/spec/opal/stdlib/strscan/scan_spec.rb +11 -0
  86. data/spec/rubyspecs +6 -9
  87. data/spec/spec_helper.rb +9 -21
  88. data/stdlib/date.rb +121 -1
  89. data/stdlib/js.rb +13 -5
  90. data/stdlib/json.rb +3 -3
  91. data/stdlib/nashorn.rb +5 -0
  92. data/stdlib/nashorn/file.rb +13 -0
  93. data/stdlib/nashorn/io.rb +2 -0
  94. data/stdlib/native.rb +12 -4
  95. data/stdlib/nodejs/io.rb +5 -2
  96. data/stdlib/opal/platform.rb +19 -0
  97. data/stdlib/phantomjs.rb +4 -0
  98. data/stdlib/strscan.rb +1 -1
  99. data/tasks/building.rake +2 -1
  100. data/tasks/testing.rake +29 -34
  101. data/tasks/testing/{phantomjs1-sprockets.js → sprockets-phantomjs.js} +2 -20
  102. data/vendored-minitest/minitest/test.rb +7 -15
  103. metadata +32 -9
  104. data/lib/mspec/opal/main.rb.erb +0 -9
@@ -18,4 +18,4 @@ describe "Kernel#extend" do
18
18
  obj.extend KernelExtendSpecs::Mod
19
19
  obj.foo.should == 3.142
20
20
  end
21
- end
21
+ end
@@ -0,0 +1,56 @@
1
+ describe "Kernel#instance_variables" do
2
+ context 'for nil' do
3
+ it 'returns blank array' do
4
+ expect(nil.instance_variables).to eq([])
5
+ end
6
+ end
7
+
8
+ context 'for string' do
9
+ it 'returns blank array' do
10
+ expect(''.instance_variables).to eq([])
11
+ end
12
+ end
13
+
14
+ context 'for hash' do
15
+ it 'returns blank array' do
16
+ expect({}.instance_variables).to eq([])
17
+ end
18
+ end
19
+
20
+ context 'for object' do
21
+ it 'returns blank array' do
22
+ expect(Object.new.instance_variables).to eq([])
23
+ end
24
+ end
25
+
26
+ context 'cloned object' do
27
+ it 'returns same vars as source object' do
28
+ object = Object.new
29
+ expect(object.clone.instance_variables).to eq(object.instance_variables)
30
+ end
31
+ end
32
+
33
+ context 'for object with js keyword as instance variables' do
34
+ reserved_keywords = %w(
35
+ @constructor
36
+ @displayName
37
+ @__proto__
38
+ @__parent__
39
+ @__noSuchMethod__
40
+ @__count__
41
+ @hasOwnProperty
42
+ @valueOf
43
+ )
44
+
45
+ reserved_keywords.each do |ivar|
46
+ context "#{ivar} as instance variable name" do
47
+ it "returns non-escaped #{ivar} in instance_variables list" do
48
+ obj = Object.new
49
+ obj.instance_variable_set(ivar, 'value')
50
+
51
+ expect(obj.instance_variables).to eq([ivar])
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,8 @@
1
+ describe "BasicObject#equal?" do
2
+ it "compares usign low level identity" do
3
+ obj = BasicObject.new
4
+ obj2 = BasicObject.new
5
+ obj.equal?(obj).should == true
6
+ obj.equal?(obj2).should == false
7
+ end
8
+ end
@@ -114,7 +114,7 @@ describe "The predefined global constants" do
114
114
 
115
115
  it "includes RUBY_VERSION" do
116
116
  Object.const_defined?(:RUBY_VERSION).should == true
117
- RUBY_VERSION.should == "2.1.5"
117
+ RUBY_VERSION.should == "2.2.3"
118
118
  end
119
119
 
120
120
  it "includes RUBY_RELEASE_DATE" do
@@ -0,0 +1,14 @@
1
+ describe "Ternary condition operator" do
2
+ it "returns the second argument if the condition is true" do
3
+ (true ? 1 : 2).should == 1
4
+ end
5
+
6
+ it "returns the third argument if the condition is false" do
7
+ (false ? 1 : 2).should == 2
8
+ end
9
+
10
+ it "doesn't get confused if : follows a string literal" do
11
+ # this could be interpreted as a Ruby 1.9 symbol hash key
12
+ (true ?'str':'another str').should == 'str'
13
+ end
14
+ end
@@ -14,5 +14,10 @@ describe "Hash literal" do
14
14
  {rbx: :cool, :specs => 'fail_sometimes'}.should == {:rbx => :cool, :specs => 'fail_sometimes'}
15
15
  {'rbx' => :cool, specs: 'fail_sometimes'}.should == {'rbx' => :cool, :specs => 'fail_sometimes'}
16
16
  end
17
+
18
+ it "accepts symbol keys using 'string': syntax" do
19
+ {'test': :test}.should == {test: :test}
20
+ {'symbol literal': :test}.should == {:'symbol literal' => :test}
21
+ end
17
22
  end
18
23
  end
@@ -431,4 +431,14 @@ module Kernel
431
431
  private :module_specs_public_method_on_object_for_kernel_private
432
432
  end
433
433
 
434
- # ModuleSpecs::Nesting[:root_level] = Module.nesting
434
+ class Class
435
+ def test_method_overlapping_module_method
436
+ :class
437
+ end
438
+ end
439
+
440
+ class Module
441
+ def test_method_overlapping_module_method
442
+ :module
443
+ end
444
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path('../fixtures/classes', __FILE__)
2
+
3
+ describe 'Method lookup for instances of Module' do
4
+ it 'takes own method, not the one defined on the Class' do
5
+ Module.new.test_method_overlapping_module_method.should == :module
6
+ end
7
+ end
8
+
9
+ describe 'Method lookup for instances of Class' do
10
+ it 'takes own method, not the one defined on the Module' do
11
+ Class.new.test_method_overlapping_module_method.should == :class
12
+ end
13
+ end
@@ -46,6 +46,12 @@ class SingletonMethodSuperSpec
46
46
  super 2, *[3, 4]
47
47
  end
48
48
  end
49
+
50
+ module M
51
+ def self.foo
52
+ super
53
+ end
54
+ end
49
55
  end
50
56
 
51
57
  class MultipleSuperSpec
@@ -108,6 +114,10 @@ describe "The 'super' keyword" do
108
114
  lambda { MultipleSuperSpec.new.to_s }.should_not raise_error
109
115
  end
110
116
  end
117
+
118
+ it "works on module singleton methods (see issue #935)" do
119
+ lambda { SingletonMethodSuperSpec::M.foo }.should raise_error(NoMethodError)
120
+ end
111
121
  end
112
122
 
113
123
 
@@ -5,4 +5,88 @@ describe "Native()" do
5
5
  Native(`null`).should be_nil
6
6
  Native(`undefined`).should be_nil
7
7
  end
8
+
9
+ it "should return String" do
10
+ Native(`""`).should be_an_instance_of String
11
+ end
12
+
13
+ it "should return Integer" do
14
+ Native(`0`).should be_an_instance_of Number
15
+ end
16
+
17
+ it "should return Float" do
18
+ Native(`0.01`).should be_an_instance_of Float
19
+ end
20
+
21
+ it "should return Array" do
22
+ Native(`[]`).should be_an_instance_of Array
23
+ end
24
+
25
+ it "should return Native::Object" do
26
+ Native(`{}`).instance_of?(Native::Object).should be_true
27
+ end
28
+
29
+ it "should return Array of String" do
30
+ Native(`[""]`).first.should be_an_instance_of String
31
+ end
32
+
33
+ it "should return Array of Integer" do
34
+ Native(`[0]`).first.should be_an_instance_of Number
35
+ end
36
+
37
+ it "should return Array of Float" do
38
+ Native(`[0.01]`).first.should be_an_instance_of Float
39
+ end
40
+
41
+ it "should return Array of Array" do
42
+ Native(`[[]]`).first.should be_an_instance_of Array
43
+ end
44
+
45
+ it "should return Array of Native::Object" do
46
+ Native(`[{}]`).first.instance_of?(Native::Object).should be_true
47
+ end
48
+
49
+ it "should return Object with String" do
50
+ Native(`{"key": ""}`)["key"].should be_an_instance_of String
51
+ end
52
+
53
+ it "should return Object with Integer" do
54
+ Native(`{"key": 0}`)["key"].should be_an_instance_of Number
55
+ end
56
+
57
+ it "should return Object with Float" do
58
+ Native(`{"key": 0.01}`)["key"].should be_an_instance_of Float
59
+ end
60
+
61
+ it "should return Object with Array" do
62
+ Native(`{"key": []}`)["key"].should be_an_instance_of Array
63
+ end
64
+
65
+ it "should return Native::Object with Native::Object" do
66
+ Native(`{"key": {}}`)["key"].instance_of?(Native::Object).should be_true
67
+ end
68
+
69
+ it "should return Proc" do
70
+ Native(`function(){}`).should be_an_instance_of Proc
71
+ end
72
+
73
+ it "should return Proc that return String" do
74
+ Native(`function(){return ""}`).call.should be_an_instance_of String
75
+ end
76
+
77
+ it "should return Proc that return Integer" do
78
+ Native(`function(){return 0}`).call.should be_an_instance_of Integer
79
+ end
80
+
81
+ it "should return Proc that return Float" do
82
+ Native(`function(){return 0.01}`).call.should be_an_instance_of Float
83
+ end
84
+
85
+ it "should return Proc that return Array" do
86
+ Native(`function(){return []}`).call.should be_an_instance_of Array
87
+ end
88
+
89
+ it "should return Proc that return Native::Object" do
90
+ Native(`function(){return {}}`).call.instance_of?(Native::Object).should be_true
91
+ end
8
92
  end
@@ -0,0 +1,11 @@
1
+ require 'strscan'
2
+
3
+ describe "StringScanner#scan" do
4
+ context "when the regex has multiple alternatives" do
5
+ it "still anchors to the beginning of the remaining text" do
6
+ # regression test; see GH issue 1074
7
+ scanner = StringScanner.new("10\nb = `2E-16`")
8
+ scanner.scan(/[\d_]+\.[\d_]+\b|[\d_]+(\.[\d_]+)?[eE][-+]?[\d_]+\b/).should be_nil
9
+ end
10
+ end
11
+ end
data/spec/rubyspecs CHANGED
@@ -31,16 +31,13 @@ rubyspec/core/kernel
31
31
  !rubyspec/core/kernel/chop_spec
32
32
  !rubyspec/core/kernel/exec_spec
33
33
  !rubyspec/core/kernel/exit_spec
34
- !rubyspec/core/kernel/extend_spec
35
- rubyspec/core/kernel/fail_spec
36
34
  !rubyspec/core/kernel/fork_spec
37
35
  !rubyspec/core/kernel/gets_spec
38
36
  !rubyspec/core/kernel/load_spec
39
37
  !rubyspec/core/kernel/open_spec
40
38
  !rubyspec/core/kernel/putc_spec
41
- rubyspec/core/kernel/raise_spec
42
- !rubyspec/core/kernel/readline_spec
43
39
  !rubyspec/core/kernel/readlines_spec
40
+ !rubyspec/core/kernel/readline_spec
44
41
  !rubyspec/core/kernel/require_relative_spec
45
42
  !rubyspec/core/kernel/require_spec
46
43
  !rubyspec/core/kernel/select_spec
@@ -48,8 +45,8 @@ rubyspec/core/kernel/raise_spec
48
45
  !rubyspec/core/kernel/spawn_spec
49
46
  !rubyspec/core/kernel/syscall_spec
50
47
  !rubyspec/core/kernel/system_spec
51
- !rubyspec/core/kernel/taint_spec
52
48
  !rubyspec/core/kernel/tainted_spec
49
+ !rubyspec/core/kernel/taint_spec
53
50
  !rubyspec/core/kernel/test_spec
54
51
  !rubyspec/core/kernel/throw_spec
55
52
  !rubyspec/core/kernel/trace_var_spec
@@ -57,8 +54,8 @@ rubyspec/core/kernel/raise_spec
57
54
  !rubyspec/core/kernel/trust_spec
58
55
  !rubyspec/core/kernel/untaint_spec
59
56
  !rubyspec/core/kernel/untrace_var_spec
60
- !rubyspec/core/kernel/untrust_spec
61
57
  !rubyspec/core/kernel/untrusted_spec
58
+ !rubyspec/core/kernel/untrust_spec
62
59
 
63
60
  rubyspec/core/matchdata
64
61
  rubyspec/core/math
@@ -117,20 +114,18 @@ rubyspec/language
117
114
  !rubyspec/language/encoding_spec
118
115
  !rubyspec/language/execution_spec
119
116
  !rubyspec/language/hash_spec
120
- !rubyspec/language/line_spec
121
117
  !rubyspec/language/lambda_spec
118
+ !rubyspec/language/line_spec
122
119
  !rubyspec/language/match_spec
123
120
  !rubyspec/language/method_spec
124
121
  !rubyspec/language/next_spec
125
122
  !rubyspec/language/predefined_spec
126
123
  !rubyspec/language/proc_spec
127
124
  !rubyspec/language/regexp_spec
128
- rubyspec/language/regexp/modifiers_spec
129
125
  !rubyspec/language/return_spec
130
126
  !rubyspec/language/send_spec
131
127
  !rubyspec/language/string_spec
132
128
  !rubyspec/language/symbol_spec
133
- !rubyspec/language/variables_spec
134
129
  !rubyspec/language/while_spec
135
130
  !rubyspec/language/yield_spec
136
131
 
@@ -142,10 +137,12 @@ rubyspec/library/erb/util/h_spec
142
137
  rubyspec/library/erb/util/html_escape_spec
143
138
 
144
139
  rubyspec/library/observer
140
+
145
141
  rubyspec/library/openstruct
146
142
  !rubyspec/library/openstruct/frozen_spec
147
143
  !rubyspec/library/openstruct/marshal_load_spec
148
144
  !rubyspec/library/openstruct/marshal_dump_spec
145
+
149
146
  rubyspec/library/pathname
150
147
  rubyspec/library/pp
151
148
  rubyspec/library/set
data/spec/spec_helper.rb CHANGED
@@ -20,31 +20,19 @@ module Kernel
20
20
  def eval_js(javascript)
21
21
  `eval(javascript)`
22
22
  end
23
-
24
- def at_exit(&block)
25
- $AT_EXIT_CALLBACKS ||= []
26
- $AT_EXIT_CALLBACKS << block
27
- end
28
23
  end
29
24
 
30
- is_node = `typeof(process) == 'object' && !!process.versions.node`
31
- is_browser = `(typeof(window) !== 'undefined')`
32
- is_phantom = is_browser && `!!window.OPAL_SPEC_PHANTOM`
33
-
34
- case
35
- when is_node
36
- formatter_class = NodeJSFormatter
37
- when is_phantom
38
- require 'phantomjs'
39
- formatter_class = PhantomFormatter
40
- else
41
- formatter_class = BrowserFormatter
42
- end
25
+ require 'mspec/utils/script' # Needed by DottedFormatter
26
+ formatter_class = DottedFormatter
43
27
 
44
- # Uncomment the following to see example titles when they're executed.
45
- # (useful to relate debug output to the example that generated it)
28
+ require 'mspec/opal/formatters'
29
+ # Uncomment one of the following to use a different formatter:
46
30
  #
47
- #formatter_class = PhantomDebugFormatter
31
+ #formatter_class = BrowserFormatter
32
+ #formatter_class = NodeJSFormatter
33
+ #formatter_class = NodeJSDocFormatter
34
+ #formatter_class = PhantomFormatter
35
+ #formatter_class = PhantomDocFormatter
48
36
 
49
37
  # As soon as this file loads, tell the runner the specs are starting
50
38
  OSpecRunner.main(formatter_class).will_start
data/stdlib/date.rb CHANGED
@@ -1,4 +1,84 @@
1
1
  class Date
2
+ class Infinity < Numeric
3
+ include Comparable
4
+
5
+ def initialize(d = 1)
6
+ @d = d <=> 0
7
+ end
8
+
9
+ def d
10
+ @d
11
+ end
12
+
13
+ def zero?
14
+ false
15
+ end
16
+
17
+ def finite?
18
+ false
19
+ end
20
+
21
+ def infinite?
22
+ d.nonzero?
23
+ end
24
+
25
+ def nan?
26
+ d.zero?
27
+ end
28
+
29
+ def abs
30
+ self.class.new
31
+ end
32
+
33
+ def -@
34
+ self.class.new(-d)
35
+ end
36
+
37
+ def +@
38
+ self.class.new(+d)
39
+ end
40
+
41
+ def <=> (other)
42
+ case other
43
+ when Infinity; return d <=> other.d
44
+ when Numeric; return d
45
+ else
46
+ begin
47
+ l, r = other.coerce(self)
48
+ return l <=> r
49
+ rescue NoMethodError
50
+ end
51
+ end
52
+ nil
53
+ end
54
+
55
+ def coerce(other)
56
+ case other
57
+ when Numeric
58
+ return -d, d
59
+ else
60
+ super
61
+ end
62
+ end
63
+
64
+ def to_f
65
+ return 0 if @d == 0
66
+ if @d > 0
67
+ Float::INFINITY
68
+ else
69
+ -Float::INFINITY
70
+ end
71
+ end
72
+ end
73
+
74
+ JULIAN = Infinity.new
75
+ GREGORIAN = -Infinity.new
76
+ ITALY = 2299161 # 1582-10-15
77
+ ENGLAND = 2361222 # 1752-09-14
78
+ MONTHNAMES = [nil] + %w(January February March April May June July August September October November December)
79
+ DAYNAMES = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
80
+ ABBR_DAYNAMES = %w(Sun Mon Tue Wed Thu Fri Sat)
81
+
2
82
  class << self
3
83
  alias civil new
4
84
 
@@ -18,7 +98,7 @@ class Date
18
98
  end
19
99
  end
20
100
 
21
- def initialize(year = undefined, month = undefined, day = undefined)
101
+ def initialize(year = -4712, month = 1, day = 1, start = ITALY)
22
102
  @date = `new Date(year, month - 1, day)`
23
103
  end
24
104
 
@@ -150,6 +230,46 @@ class Date
150
230
  wday == 5
151
231
  end
152
232
 
233
+ def jd
234
+ %x{
235
+ //Adapted from http://www.physics.sfasu.edu/astro/javascript/julianday.html
236
+
237
+ var mm = #@date.getMonth() + 1,
238
+ dd = #@date.getDate(),
239
+ yy = #@date.getFullYear(),
240
+ hr = 12, mn = 0, sc = 0,
241
+ ggg, s, a, j1, jd;
242
+
243
+ hr = hr + (mn / 60) + (sc/3600);
244
+
245
+ ggg = 1;
246
+ if (yy <= 1585) {
247
+ ggg = 0;
248
+ }
249
+
250
+ jd = -1 * Math.floor(7 * (Math.floor((mm + 9) / 12) + yy) / 4);
251
+
252
+ s = 1;
253
+ if ((mm - 9) < 0) {
254
+ s =- 1;
255
+ }
256
+
257
+ a = Math.abs(mm - 9);
258
+ j1 = Math.floor(yy + s * Math.floor(a / 7));
259
+ j1 = -1 * Math.floor((Math.floor(j1 / 100) + 1) * 3 / 4);
260
+
261
+ jd = jd + Math.floor(275 * mm / 9) + dd + (ggg * j1);
262
+ jd = jd + 1721027 + 2 * ggg + 367 * yy - 0.5;
263
+ jd = jd + (hr / 24);
264
+
265
+ return jd;
266
+ }
267
+ end
268
+
269
+ def julian?
270
+ `#@date < new Date(1582, 10 - 1, 15, 12)`
271
+ end
272
+
153
273
  def monday?
154
274
  wday == 1
155
275
  end