dxopal 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 424ba3e6e022bca706bb371fd2639e89692cd165
4
- data.tar.gz: d64bb9308195513c05f71420469090040e9fc788
2
+ SHA256:
3
+ metadata.gz: b41a4ded00dc47826b9f2260c2858d0f2ac949d84152ff94caf559f04464b914
4
+ data.tar.gz: 1f3a1fe4932bd83a323de0d2ec03cf86e2a426e4b076360aae586d7ad26f6c68
5
5
  SHA512:
6
- metadata.gz: 598063093aa21eafeedd84c79ea74744735f1f6e4bb3950c072377ecc2a893f1ad106a8ffce532dd7921f2517981ae625a6e6185f88a7170c2e9194e43c2b637
7
- data.tar.gz: 637fac5102028e9050629e49802b37fceeef09cf50ba255bc622d5adb20694f07bb9126fc582b98e1decc9777c566d5063c080ba23b5a7d4694910e629937594
6
+ metadata.gz: 7b62b0900d1d6b92242957d05736d3b8a9c3a64b0bc758633fe64afb2e04d564396a1a14e3c0d033717a8420c3e9802a83fed30ab691e35a1e23f81994b5ebc9
7
+ data.tar.gz: 7c7f20d6d926d3d0c1cfc0ee457b72d283ba18734a4db0d0ed3c4991bf23e695067ae12919bb90020e15270343cfd13356a7bf0bda6c25e9c8aae3fbf0738b49
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## v1.2.0 (2018-05-16)
2
+
3
+ - new: Support shift/ctrl key
4
+ - new: Added some opal stdlibs
5
+ - singleton
6
+ - delegate, forwardable
7
+ - promise
8
+ - set
9
+ - time
10
+ - ([Let me know](https://github.com/yhara/dxopal/issues/) if you need some more)
11
+ - new: Sound#stop
12
+ - fix: `z` for draw_xx did not work correctly
13
+
1
14
  ## v1.1.0 (2018-02-05)
2
15
 
3
16
  ### Breaking change: matter.js is split from dxopal.js
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dxopal (1.1.0)
4
+ dxopal (1.2.0.dev)
5
5
  opal (~> 0.11.0)
6
6
  rack (~> 2.0)
7
7
  thor (~> 0.19.1)
@@ -23,6 +23,7 @@ GEM
23
23
  tilt (>= 1.4)
24
24
  parser (2.3.3.1)
25
25
  ast (~> 2.2)
26
+ puma (3.11.2)
26
27
  rack (2.0.3)
27
28
  rake (10.5.0)
28
29
  sourcemap (0.1.1)
@@ -40,8 +41,9 @@ DEPENDENCIES
40
41
  bundler (~> 1.14)
41
42
  dxopal!
42
43
  opal-sprockets (~> 0.4.1)
44
+ puma (~> 3.11.2)
43
45
  rake (~> 10.0)
44
46
  yard (~> 0.9.12)
45
47
 
46
48
  BUNDLED WITH
47
- 1.16.0
49
+ 1.16.1
data/Rakefile CHANGED
@@ -56,7 +56,7 @@ namespace "release" do
56
56
  end
57
57
 
58
58
  # How to make a release
59
- # 0. Edit lib/dxopal/version.rb
59
+ # 0. Edit opal/dxopal/version.rb
60
60
  # 1. Edit CHANGELOG.md
61
61
  # 2. `rake release:make_release_commit`
62
62
  # 3. Test
data/build/dxopal.js CHANGED
@@ -22865,14 +22865,14 @@ Opal.modules["dxopal/input"] = function(Opal) {
22865
22865
  }, TMP_Input_key_release$q_8.$$arity = 1);
22866
22866
  Opal.const_set($nesting[0], 'ON_KEYDOWN_',
22867
22867
  function(ev){
22868
- Opal.const_get_relative($nesting, 'Input').$_pressing_keys()[ev.keyCode] = (($a = $Input.$$cvars['@@tick']) == null ? nil : $a);
22868
+ Opal.const_get_relative($nesting, 'Input').$_pressing_keys()[ev.code] = (($a = $Input.$$cvars['@@tick']) == null ? nil : $a);
22869
22869
  ev.preventDefault();
22870
22870
  ev.stopPropagation();
22871
22871
  }
22872
22872
  );
22873
22873
  Opal.const_set($nesting[0], 'ON_KEYUP_',
22874
22874
  function(ev){
22875
- Opal.const_get_relative($nesting, 'Input').$_pressing_keys()[ev.keyCode] = -(($a = $Input.$$cvars['@@tick']) == null ? nil : $a);
22875
+ Opal.const_get_relative($nesting, 'Input').$_pressing_keys()[ev.code] = -(($a = $Input.$$cvars['@@tick']) == null ? nil : $a);
22876
22876
  ev.preventDefault();
22877
22877
  ev.stopPropagation();
22878
22878
  }
@@ -22984,45 +22984,61 @@ Opal.modules["dxopal/input/key_codes"] = function(Opal) {
22984
22984
  var def = self.$$proto, $nesting = [self].concat($parent_nesting);
22985
22985
 
22986
22986
 
22987
- Opal.const_set($nesting[0], 'K_ESCAPE', 27);
22988
- Opal.const_set($nesting[0], 'K_MINUS', 189);
22989
- Opal.const_set($nesting[0], 'K_BACK', 8);
22990
- Opal.const_set($nesting[0], 'K_TAB', 9);
22991
- Opal.const_set($nesting[0], 'K_Q', 81);
22992
- Opal.const_set($nesting[0], 'K_W', 87);
22993
- Opal.const_set($nesting[0], 'K_E', 69);
22994
- Opal.const_set($nesting[0], 'K_R', 82);
22995
- Opal.const_set($nesting[0], 'K_T', 84);
22996
- Opal.const_set($nesting[0], 'K_Y', 89);
22997
- Opal.const_set($nesting[0], 'K_U', 85);
22998
- Opal.const_set($nesting[0], 'K_I', 73);
22999
- Opal.const_set($nesting[0], 'K_O', 79);
23000
- Opal.const_set($nesting[0], 'K_P', 80);
23001
- Opal.const_set($nesting[0], 'K_LBRACKET', 219);
23002
- Opal.const_set($nesting[0], 'K_RBRACKET', 221);
23003
- Opal.const_set($nesting[0], 'K_RETURN', 13);
23004
- Opal.const_set($nesting[0], 'K_A', 65);
23005
- Opal.const_set($nesting[0], 'K_S', 83);
23006
- Opal.const_set($nesting[0], 'K_D', 68);
23007
- Opal.const_set($nesting[0], 'K_F', 70);
23008
- Opal.const_set($nesting[0], 'K_G', 71);
23009
- Opal.const_set($nesting[0], 'K_H', 72);
23010
- Opal.const_set($nesting[0], 'K_J', 74);
23011
- Opal.const_set($nesting[0], 'K_K', 75);
23012
- Opal.const_set($nesting[0], 'K_L', 76);
23013
- Opal.const_set($nesting[0], 'K_SEMICOLON', 186);
23014
- Opal.const_set($nesting[0], 'K_BACKSLASH', 0);
23015
- Opal.const_set($nesting[0], 'K_Z', 90);
23016
- Opal.const_set($nesting[0], 'K_X', 88);
23017
- Opal.const_set($nesting[0], 'K_C', 67);
23018
- Opal.const_set($nesting[0], 'K_V', 86);
23019
- Opal.const_set($nesting[0], 'K_B', 66);
23020
- Opal.const_set($nesting[0], 'K_N', 78);
23021
- Opal.const_set($nesting[0], 'K_M', 77);
23022
- Opal.const_set($nesting[0], 'K_COMMA', 188);
23023
- Opal.const_set($nesting[0], 'K_PERIOD', 190);
23024
- Opal.const_set($nesting[0], 'K_SLASH', 191);
23025
- Opal.const_set($nesting[0], 'K_SPACE', 32);
22987
+ Opal.const_set($nesting[0], 'K_ESCAPE', "Escape");
22988
+ Opal.const_set($nesting[0], 'K_1', "Digit1");
22989
+ Opal.const_set($nesting[0], 'K_2', "Digit2");
22990
+ Opal.const_set($nesting[0], 'K_3', "Digit3");
22991
+ Opal.const_set($nesting[0], 'K_4', "Digit4");
22992
+ Opal.const_set($nesting[0], 'K_5', "Digit5");
22993
+ Opal.const_set($nesting[0], 'K_6', "Digit6");
22994
+ Opal.const_set($nesting[0], 'K_7', "Digit7");
22995
+ Opal.const_set($nesting[0], 'K_8', "Digit8");
22996
+ Opal.const_set($nesting[0], 'K_9', "Digit9");
22997
+ Opal.const_set($nesting[0], 'K_0', "Digit0");
22998
+ Opal.const_set($nesting[0], 'K_MINUS', "Minus");
22999
+ Opal.const_set($nesting[0], 'K_EQUALS', "Equal");
23000
+ Opal.const_set($nesting[0], 'K_BACK', "Backspace");
23001
+ Opal.const_set($nesting[0], 'K_TAB', "Tab");
23002
+ Opal.const_set($nesting[0], 'K_Q', "KeyQ");
23003
+ Opal.const_set($nesting[0], 'K_W', "KeyW");
23004
+ Opal.const_set($nesting[0], 'K_E', "KeyE");
23005
+ Opal.const_set($nesting[0], 'K_R', "KeyR");
23006
+ Opal.const_set($nesting[0], 'K_T', "KeyT");
23007
+ Opal.const_set($nesting[0], 'K_Y', "KeyY");
23008
+ Opal.const_set($nesting[0], 'K_U', "KeyU");
23009
+ Opal.const_set($nesting[0], 'K_I', "KeyI");
23010
+ Opal.const_set($nesting[0], 'K_O', "KeyO");
23011
+ Opal.const_set($nesting[0], 'K_P', "KeyP");
23012
+ Opal.const_set($nesting[0], 'K_LBRACKET', "BracketLeft");
23013
+ Opal.const_set($nesting[0], 'K_RBRACKET', "BracketRight");
23014
+ Opal.const_set($nesting[0], 'K_RETURN', "Enter");
23015
+ Opal.const_set($nesting[0], 'K_ENTER', "Enter");
23016
+ Opal.const_set($nesting[0], 'K_LCONTROL', "ControlLeft");
23017
+ Opal.const_set($nesting[0], 'K_A', "KeyA");
23018
+ Opal.const_set($nesting[0], 'K_S', "KeyS");
23019
+ Opal.const_set($nesting[0], 'K_D', "KeyD");
23020
+ Opal.const_set($nesting[0], 'K_F', "KeyF");
23021
+ Opal.const_set($nesting[0], 'K_G', "KeyG");
23022
+ Opal.const_set($nesting[0], 'K_H', "KeyH");
23023
+ Opal.const_set($nesting[0], 'K_J', "KeyJ");
23024
+ Opal.const_set($nesting[0], 'K_K', "KeyK");
23025
+ Opal.const_set($nesting[0], 'K_L', "KeyL");
23026
+ Opal.const_set($nesting[0], 'K_SEMICOLON', "Semicolon");
23027
+ Opal.const_set($nesting[0], 'K_APOSTROPHE', "Quote");
23028
+ Opal.const_set($nesting[0], 'K_LSHIFT', "ShiftLeft");
23029
+ Opal.const_set($nesting[0], 'K_BACKSLASH', "BackSlash");
23030
+ Opal.const_set($nesting[0], 'K_Z', "KeyZ");
23031
+ Opal.const_set($nesting[0], 'K_X', "KeyX");
23032
+ Opal.const_set($nesting[0], 'K_C', "KeyC");
23033
+ Opal.const_set($nesting[0], 'K_V', "KeyV");
23034
+ Opal.const_set($nesting[0], 'K_B', "KeyB");
23035
+ Opal.const_set($nesting[0], 'K_N', "KeyN");
23036
+ Opal.const_set($nesting[0], 'K_M', "KeyM");
23037
+ Opal.const_set($nesting[0], 'K_COMMA', "Comma");
23038
+ Opal.const_set($nesting[0], 'K_PERIOD', "Period");
23039
+ Opal.const_set($nesting[0], 'K_SLASH', "Slash");
23040
+ Opal.const_set($nesting[0], 'K_RSHIFT', "ShiftRight");
23041
+ Opal.const_set($nesting[0], 'K_SPACE', "Space");
23026
23042
  Opal.const_set($nesting[0], 'K_F1', 112);
23027
23043
  Opal.const_set($nesting[0], 'K_F2', 113);
23028
23044
  Opal.const_set($nesting[0], 'K_F3', 114);
@@ -23038,19 +23054,20 @@ Opal.modules["dxopal/input/key_codes"] = function(Opal) {
23038
23054
  Opal.const_set($nesting[0], 'K_F13', 124);
23039
23055
  Opal.const_set($nesting[0], 'K_F14', 125);
23040
23056
  Opal.const_set($nesting[0], 'K_F15', 126);
23041
- Opal.const_set($nesting[0], 'K_PREVTRACK', 187);
23042
- Opal.const_set($nesting[0], 'K_AT', 219);
23043
- Opal.const_set($nesting[0], 'K_COLON', 186);
23044
- Opal.const_set($nesting[0], 'K_UNDERLINE', 189);
23045
- Opal.const_set($nesting[0], 'K_UP', 38);
23046
- Opal.const_set($nesting[0], 'K_LEFT', 37);
23047
- Opal.const_set($nesting[0], 'K_RIGHT', 39);
23048
- Opal.const_set($nesting[0], 'K_DOWN', 40);
23049
- Opal.const_set($nesting[0], 'K_BACKSPACE', 8);
23050
- Opal.const_set($nesting[0], 'K_UPARROW', 38);
23051
- Opal.const_set($nesting[0], 'K_LEFTARROW', 37);
23052
- Opal.const_set($nesting[0], 'K_RIGHTARROW', 39);
23053
- Opal.const_set($nesting[0], 'K_DOWNARROW', 40);
23057
+ Opal.const_set($nesting[0], 'K_YEN', "IntlYen");
23058
+ Opal.const_set($nesting[0], 'K_COLON', "Colon");
23059
+ Opal.const_set($nesting[0], 'K_UNDERLINE', "IntlRo");
23060
+ Opal.const_set($nesting[0], 'K_RCONTROL', "ControlRight");
23061
+ Opal.const_set($nesting[0], 'K_UP', "ArrowUp");
23062
+ Opal.const_set($nesting[0], 'K_LEFT', "ArrowLeft");
23063
+ Opal.const_set($nesting[0], 'K_RIGHT', "ArrowRight");
23064
+ Opal.const_set($nesting[0], 'K_DOWN', "ArrowDown");
23065
+ Opal.const_set($nesting[0], 'K_BACKSPACE', "Backspace");
23066
+ Opal.const_set($nesting[0], 'K_CAPSLOCK', "CapsLock");
23067
+ Opal.const_set($nesting[0], 'K_UPARROW', "ArrowUp");
23068
+ Opal.const_set($nesting[0], 'K_LEFTARROW', "ArrowLeft");
23069
+ Opal.const_set($nesting[0], 'K_RIGHTARROW', "ArrowRight");
23070
+ Opal.const_set($nesting[0], 'K_DOWNARROW', "ArrowDown");
23054
23071
  })($nesting[0], $nesting)
23055
23072
  })($nesting[0], $nesting)
23056
23073
  })($nesting[0], $nesting)
@@ -23645,9 +23662,9 @@ Opal.modules["dxopal/sound"] = function(Opal) {
23645
23662
  function $Sound(){};
23646
23663
  var self = $Sound = $klass($base, $super, 'Sound', $Sound);
23647
23664
 
23648
- var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Sound_audio_context_1, TMP_Sound__load_2, TMP_Sound_initialize_3, TMP_Sound_play_4;
23665
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Sound_audio_context_1, TMP_Sound__load_2, TMP_Sound_initialize_3, TMP_Sound_play_4, TMP_Sound_stop_5;
23649
23666
 
23650
- def.decoded = nil;
23667
+ def.decoded = def.source = nil;
23651
23668
 
23652
23669
  Opal.const_get_relative($nesting, 'RemoteResource').$add_class(Opal.const_get_relative($nesting, 'Sound'));
23653
23670
  Opal.defs(self, '$audio_context', TMP_Sound_audio_context_1 = function $$audio_context() {
@@ -23687,22 +23704,39 @@ Opal.modules["dxopal/sound"] = function(Opal) {
23687
23704
  return (self.path_or_url = path_or_url)
23688
23705
  }, TMP_Sound_initialize_3.$$arity = 1);
23689
23706
  self.$attr_accessor("decoded");
23690
- return (Opal.defn(self, '$play', TMP_Sound_play_4 = function $$play() {
23691
- var self = this;
23707
+
23708
+ Opal.defn(self, '$play', TMP_Sound_play_4 = function $$play() {
23709
+ var self = this, source = nil;
23692
23710
 
23693
23711
 
23694
23712
  if ($truthy(self.decoded)) {
23695
23713
  } else {
23696
23714
  self.$raise("" + "Sound " + (self.$path_or_url()) + " is not loaded yet")
23697
23715
  };
23716
+ source = nil;
23698
23717
 
23699
23718
  var context = Opal.const_get_relative($nesting, 'Sound').$audio_context();
23700
- var source = context.createBufferSource();
23719
+ source = context.createBufferSource();
23701
23720
  source.buffer = self.decoded;
23702
23721
  source.connect(context.destination);
23703
23722
  source.start(0);
23704
23723
  ;
23705
- }, TMP_Sound_play_4.$$arity = 0), nil) && 'play';
23724
+ return (self.source = source);
23725
+ }, TMP_Sound_play_4.$$arity = 0);
23726
+ return (Opal.defn(self, '$stop', TMP_Sound_stop_5 = function $$stop() {
23727
+ var self = this;
23728
+
23729
+
23730
+ if ($truthy(self.decoded)) {
23731
+ } else {
23732
+ return nil
23733
+ };
23734
+ if ($truthy(self.source)) {
23735
+ } else {
23736
+ return nil
23737
+ };
23738
+ return self.source.stop();
23739
+ }, TMP_Sound_stop_5.$$arity = 0), nil) && 'stop';
23706
23740
  })($nesting[0], Opal.const_get_relative($nesting, 'RemoteResource'), $nesting)
23707
23741
  })($nesting[0], $nesting);
23708
23742
  };
@@ -25008,7 +25042,7 @@ if (a == null) a = nil;if (b == null) b = nil;
25008
25042
  if (a['$[]'](0)['$=='](b['$[]'](0))) {
25009
25043
  return a['$[]'](1)['$<=>'](b['$[]'](1))
25010
25044
  } else {
25011
- return a['$[]'](0)['$<=>'](a['$[]'](1))
25045
+ return a['$[]'](0)['$<=>'](b['$[]'](0))
25012
25046
  }}, TMP_8.$$s = self, TMP_8.$$arity = 2, TMP_8));
25013
25047
  $send(sorted, 'each', [], (TMP_9 = function(item){var self = TMP_9.$$s || this, $c, $case = nil, $writer = nil;
25014
25048
  if (item == null) item = nil;
@@ -25239,7 +25273,7 @@ Opal.modules["dxopal/version"] = function(Opal) {
25239
25273
 
25240
25274
  var def = self.$$proto, $nesting = [self].concat($parent_nesting);
25241
25275
 
25242
- Opal.const_set($nesting[0], 'VERSION', "1.1.0")
25276
+ Opal.const_set($nesting[0], 'VERSION', "1.2.0")
25243
25277
  })($nesting[0], $nesting)
25244
25278
  };
25245
25279
 
@@ -25624,12 +25658,9 @@ Opal.modules["ast/node"] = function(Opal) {
25624
25658
  function $rb_times(lhs, rhs) {
25625
25659
  return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
25626
25660
  }
25627
- function $rb_ge(lhs, rhs) {
25628
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs);
25629
- }
25630
25661
  var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
25631
25662
 
25632
- Opal.add_stubs(['$attr_reader', '$to_sym', '$freeze', '$to_a', '$assign_properties', '$hash', '$class', '$eql?', '$type', '$children', '$each', '$instance_variable_set', '$protected', '$private', '$==', '$nil?', '$send', '$original_dup', '$equal?', '$respond_to?', '$to_ast', '$updated', '$+', '$*', '$fancy_type', '$index', '$is_a?', '$count', '$each_with_index', '$>=', '$to_sexp', '$inspect', '$gsub', '$to_s']);
25663
+ Opal.add_stubs(['$attr_reader', '$to_sym', '$freeze', '$to_a', '$assign_properties', '$hash', '$class', '$eql?', '$type', '$children', '$each', '$instance_variable_set', '$protected', '$private', '$==', '$nil?', '$send', '$original_dup', '$equal?', '$respond_to?', '$to_ast', '$updated', '$+', '$*', '$fancy_type', '$is_a?', '$to_sexp', '$inspect', '$map', '$to_sexp_array', '$gsub', '$to_s']);
25633
25664
  return (function($base, $parent_nesting) {
25634
25665
  var $AST, self = $AST = $module($base, 'AST');
25635
25666
 
@@ -25639,12 +25670,13 @@ Opal.modules["ast/node"] = function(Opal) {
25639
25670
  function $Node(){};
25640
25671
  var self = $Node = $klass($base, $super, 'Node', $Node);
25641
25672
 
25642
- var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Node_initialize_1, TMP_Node_eql$q_2, TMP_Node_assign_properties_4, TMP_Node_dup_5, TMP_Node_updated_6, TMP_Node_$eq$eq_7, TMP_Node_concat_8, TMP_Node_append_9, TMP_Node_to_a_10, TMP_Node_to_sexp_13, TMP_Node_inspect_16, TMP_Node_to_ast_17, TMP_Node_fancy_type_18;
25673
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Node_initialize_1, TMP_Node_eql$q_2, TMP_Node_assign_properties_4, TMP_Node_dup_5, TMP_Node_updated_6, TMP_Node_$eq$eq_7, TMP_Node_concat_8, TMP_Node_append_9, TMP_Node_to_sexp_11, TMP_Node_inspect_13, TMP_Node_to_ast_14, TMP_Node_to_sexp_array_16, TMP_Node_fancy_type_17;
25643
25674
 
25644
25675
  def.type = def.children = nil;
25645
25676
 
25646
25677
  self.$attr_reader("type");
25647
25678
  self.$attr_reader("children");
25679
+ Opal.alias(self, "to_a", "children");
25648
25680
  self.$attr_reader("hash");
25649
25681
 
25650
25682
  Opal.defn(self, '$initialize', TMP_Node_initialize_1 = function $$initialize(type, children, properties) {
@@ -25740,14 +25772,8 @@ if (name == null) name = nil;if (value == null) value = nil;
25740
25772
  }, TMP_Node_append_9.$$arity = 1);
25741
25773
  Opal.alias(self, "<<", "append");
25742
25774
 
25743
- Opal.defn(self, '$to_a', TMP_Node_to_a_10 = function $$to_a() {
25744
- var self = this;
25745
-
25746
- return self.$children()
25747
- }, TMP_Node_to_a_10.$$arity = 0);
25748
-
25749
- Opal.defn(self, '$to_sexp', TMP_Node_to_sexp_13 = function $$to_sexp(indent) {
25750
- var $a, TMP_11, TMP_12, self = this, indented = nil, sexp = nil, first_node_child = nil;
25775
+ Opal.defn(self, '$to_sexp', TMP_Node_to_sexp_11 = function $$to_sexp(indent) {
25776
+ var TMP_10, self = this, indented = nil, sexp = nil;
25751
25777
 
25752
25778
  if (indent == null) {
25753
25779
  indent = 0;
@@ -25755,23 +25781,20 @@ if (name == null) name = nil;if (value == null) value = nil;
25755
25781
 
25756
25782
  indented = $rb_times(" ", indent);
25757
25783
  sexp = "" + (indented) + "(" + (self.$fancy_type());
25758
- first_node_child = ($truthy($a = $send(self.$children(), 'index', [], (TMP_11 = function(child){var self = TMP_11.$$s || this, $b;
25784
+ $send(self.$children(), 'each', [], (TMP_10 = function(child){var self = TMP_10.$$s || this;
25759
25785
  if (child == null) child = nil;
25760
- return ($truthy($b = child['$is_a?'](Opal.const_get_relative($nesting, 'Node'))) ? $b : child['$is_a?'](Opal.const_get_relative($nesting, 'Array')))}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11))) ? $a : self.$children().$count());
25761
- $send(self.$children(), 'each_with_index', [], (TMP_12 = function(child, idx){var self = TMP_12.$$s || this, $b;
25762
- if (child == null) child = nil;if (idx == null) idx = nil;
25763
- if ($truthy(($truthy($b = child['$is_a?'](Opal.const_get_relative($nesting, 'Node'))) ? $rb_ge(idx, first_node_child) : $b))) {
25786
+ if ($truthy(child['$is_a?'](Opal.const_get_relative($nesting, 'Node')))) {
25764
25787
  return (sexp = $rb_plus(sexp, "" + "\n" + (child.$to_sexp($rb_plus(indent, 1)))))
25765
25788
  } else {
25766
25789
  return (sexp = $rb_plus(sexp, "" + " " + (child.$inspect())))
25767
- }}, TMP_12.$$s = self, TMP_12.$$arity = 2, TMP_12));
25790
+ }}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10));
25768
25791
  sexp = $rb_plus(sexp, ")");
25769
25792
  return sexp;
25770
- }, TMP_Node_to_sexp_13.$$arity = -1);
25793
+ }, TMP_Node_to_sexp_11.$$arity = -1);
25771
25794
  Opal.alias(self, "to_s", "to_sexp");
25772
25795
 
25773
- Opal.defn(self, '$inspect', TMP_Node_inspect_16 = function $$inspect(indent) {
25774
- var $a, TMP_14, TMP_15, self = this, indented = nil, sexp = nil, first_node_child = nil;
25796
+ Opal.defn(self, '$inspect', TMP_Node_inspect_13 = function $$inspect(indent) {
25797
+ var TMP_12, self = this, indented = nil, sexp = nil;
25775
25798
 
25776
25799
  if (indent == null) {
25777
25800
  indent = 0;
@@ -25779,31 +25802,42 @@ if (child == null) child = nil;if (idx == null) idx = nil;
25779
25802
 
25780
25803
  indented = $rb_times(" ", indent);
25781
25804
  sexp = "" + (indented) + "s(:" + (self.type);
25782
- first_node_child = ($truthy($a = $send(self.$children(), 'index', [], (TMP_14 = function(child){var self = TMP_14.$$s || this, $b;
25805
+ $send(self.$children(), 'each', [], (TMP_12 = function(child){var self = TMP_12.$$s || this;
25783
25806
  if (child == null) child = nil;
25784
- return ($truthy($b = child['$is_a?'](Opal.const_get_relative($nesting, 'Node'))) ? $b : child['$is_a?'](Opal.const_get_relative($nesting, 'Array')))}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14))) ? $a : self.$children().$count());
25785
- $send(self.$children(), 'each_with_index', [], (TMP_15 = function(child, idx){var self = TMP_15.$$s || this, $b;
25786
- if (child == null) child = nil;if (idx == null) idx = nil;
25787
- if ($truthy(($truthy($b = child['$is_a?'](Opal.const_get_relative($nesting, 'Node'))) ? $rb_ge(idx, first_node_child) : $b))) {
25807
+ if ($truthy(child['$is_a?'](Opal.const_get_relative($nesting, 'Node')))) {
25788
25808
  return (sexp = $rb_plus(sexp, "" + ",\n" + (child.$inspect($rb_plus(indent, 1)))))
25789
25809
  } else {
25790
25810
  return (sexp = $rb_plus(sexp, "" + ", " + (child.$inspect())))
25791
- }}, TMP_15.$$s = self, TMP_15.$$arity = 2, TMP_15));
25811
+ }}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12));
25792
25812
  sexp = $rb_plus(sexp, ")");
25793
25813
  return sexp;
25794
- }, TMP_Node_inspect_16.$$arity = -1);
25814
+ }, TMP_Node_inspect_13.$$arity = -1);
25795
25815
 
25796
- Opal.defn(self, '$to_ast', TMP_Node_to_ast_17 = function $$to_ast() {
25816
+ Opal.defn(self, '$to_ast', TMP_Node_to_ast_14 = function $$to_ast() {
25797
25817
  var self = this;
25798
25818
 
25799
25819
  return self
25800
- }, TMP_Node_to_ast_17.$$arity = 0);
25820
+ }, TMP_Node_to_ast_14.$$arity = 0);
25821
+
25822
+ Opal.defn(self, '$to_sexp_array', TMP_Node_to_sexp_array_16 = function $$to_sexp_array() {
25823
+ var TMP_15, self = this, children_sexp_arrs = nil;
25824
+
25825
+
25826
+ children_sexp_arrs = $send(self.$children(), 'map', [], (TMP_15 = function(child){var self = TMP_15.$$s || this;
25827
+ if (child == null) child = nil;
25828
+ if ($truthy(child['$is_a?'](Opal.const_get_relative($nesting, 'Node')))) {
25829
+ return child.$to_sexp_array()
25830
+ } else {
25831
+ return child
25832
+ }}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15));
25833
+ return [self.$type()].concat(Opal.to_a(children_sexp_arrs));
25834
+ }, TMP_Node_to_sexp_array_16.$$arity = 0);
25801
25835
  self.$protected();
25802
- return (Opal.defn(self, '$fancy_type', TMP_Node_fancy_type_18 = function $$fancy_type() {
25836
+ return (Opal.defn(self, '$fancy_type', TMP_Node_fancy_type_17 = function $$fancy_type() {
25803
25837
  var self = this;
25804
25838
 
25805
25839
  return self.type.$to_s().$gsub("_", "-")
25806
- }, TMP_Node_fancy_type_18.$$arity = 0), nil) && 'fancy_type';
25840
+ }, TMP_Node_fancy_type_17.$$arity = 0), nil) && 'fancy_type';
25807
25841
  })($nesting[0], null, $nesting)
25808
25842
  })($nesting[0], $nesting)
25809
25843
  };
@@ -52404,6 +52438,323 @@ Opal.modules["opal-parser"] = function(Opal) {
52404
52438
  ;
52405
52439
  };
52406
52440
 
52441
+ /* Generated by Opal 0.11.0 */
52442
+ Opal.modules["singleton"] = function(Opal) {
52443
+ var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy;
52444
+
52445
+ Opal.add_stubs(['$raise', '$class', '$__init__', '$instance_eval', '$new', '$extend']);
52446
+ return (function($base, $parent_nesting) {
52447
+ var $Singleton, self = $Singleton = $module($base, 'Singleton');
52448
+
52449
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Singleton_clone_1, TMP_Singleton_dup_2;
52450
+
52451
+
52452
+
52453
+ Opal.defn(self, '$clone', TMP_Singleton_clone_1 = function $$clone() {
52454
+ var self = this;
52455
+
52456
+ return self.$raise(Opal.const_get_relative($nesting, 'TypeError'), "" + "can't clone instance of singleton " + (self.$class()))
52457
+ }, TMP_Singleton_clone_1.$$arity = 0);
52458
+
52459
+ Opal.defn(self, '$dup', TMP_Singleton_dup_2 = function $$dup() {
52460
+ var self = this;
52461
+
52462
+ return self.$raise(Opal.const_get_relative($nesting, 'TypeError'), "" + "can't dup instance of singleton " + (self.$class()))
52463
+ }, TMP_Singleton_dup_2.$$arity = 0);
52464
+ (function($base, $parent_nesting) {
52465
+ var $SingletonClassMethods, self = $SingletonClassMethods = $module($base, 'SingletonClassMethods');
52466
+
52467
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_SingletonClassMethods_clone_3, TMP_SingletonClassMethods_inherited_4;
52468
+
52469
+
52470
+
52471
+ Opal.defn(self, '$clone', TMP_SingletonClassMethods_clone_3 = function $$clone() {
52472
+ var self = this, $iter = TMP_SingletonClassMethods_clone_3.$$p, $yield = $iter || nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
52473
+
52474
+ if ($iter) TMP_SingletonClassMethods_clone_3.$$p = null;
52475
+ // Prepare super implicit arguments
52476
+ for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
52477
+ $zuper[$zuper_i] = arguments[$zuper_i];
52478
+ }
52479
+ return Opal.const_get_relative($nesting, 'Singleton').$__init__($send(self, Opal.find_super_dispatcher(self, 'clone', TMP_SingletonClassMethods_clone_3, false), $zuper, $iter))
52480
+ }, TMP_SingletonClassMethods_clone_3.$$arity = 0);
52481
+
52482
+ Opal.defn(self, '$inherited', TMP_SingletonClassMethods_inherited_4 = function $$inherited(sub_klass) {
52483
+ var self = this, $iter = TMP_SingletonClassMethods_inherited_4.$$p, $yield = $iter || nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
52484
+
52485
+ if ($iter) TMP_SingletonClassMethods_inherited_4.$$p = null;
52486
+ // Prepare super implicit arguments
52487
+ for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
52488
+ $zuper[$zuper_i] = arguments[$zuper_i];
52489
+ }
52490
+
52491
+ $send(self, Opal.find_super_dispatcher(self, 'inherited', TMP_SingletonClassMethods_inherited_4, false), $zuper, $iter);
52492
+ return Opal.const_get_relative($nesting, 'Singleton').$__init__(sub_klass);
52493
+ }, TMP_SingletonClassMethods_inherited_4.$$arity = 1);
52494
+ })($nesting[0], $nesting);
52495
+ (function(self, $parent_nesting) {
52496
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP___init___7, TMP_included_8;
52497
+
52498
+
52499
+
52500
+ Opal.defn(self, '$__init__', TMP___init___7 = function $$__init__(klass) {
52501
+ var TMP_5, TMP_instance_6, self = this;
52502
+
52503
+
52504
+ $send(klass, 'instance_eval', [], (TMP_5 = function(){var self = TMP_5.$$s || this;
52505
+
52506
+ return (self.singleton__instance__ = nil)}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5));
52507
+ Opal.defs(klass, '$instance', TMP_instance_6 = function $$instance() {
52508
+ var self = this;
52509
+ if (self.singleton__instance__ == null) self.singleton__instance__ = nil;
52510
+
52511
+
52512
+ if ($truthy(self.singleton__instance__)) {
52513
+ return self.singleton__instance__};
52514
+ return (self.singleton__instance__ = self.$new());
52515
+ }, TMP_instance_6.$$arity = 0);
52516
+ return klass;
52517
+ }, TMP___init___7.$$arity = 1);
52518
+ return (Opal.defn(self, '$included', TMP_included_8 = function $$included(klass) {
52519
+ var self = this, $iter = TMP_included_8.$$p, $yield = $iter || nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
52520
+
52521
+ if ($iter) TMP_included_8.$$p = null;
52522
+ // Prepare super implicit arguments
52523
+ for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
52524
+ $zuper[$zuper_i] = arguments[$zuper_i];
52525
+ }
52526
+
52527
+ $send(self, Opal.find_super_dispatcher(self, 'included', TMP_included_8, false), $zuper, $iter);
52528
+ klass.$extend(Opal.const_get_relative($nesting, 'SingletonClassMethods'));
52529
+ return Opal.const_get_relative($nesting, 'Singleton').$__init__(klass);
52530
+ }, TMP_included_8.$$arity = 1), nil) && 'included';
52531
+ })(Opal.get_singleton_class(Opal.const_get_relative($nesting, 'Singleton')), $nesting);
52532
+ })($nesting[0], $nesting)
52533
+ };
52534
+
52535
+ /* Generated by Opal 0.11.0 */
52536
+ Opal.modules["delegate"] = function(Opal) {
52537
+ var TMP_DelegateClass_5, self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send;
52538
+
52539
+ Opal.add_stubs(['$__setobj__', '$__getobj__', '$respond_to?', '$__send__', '$to_proc']);
52540
+
52541
+ (function($base, $super, $parent_nesting) {
52542
+ function $Delegator(){};
52543
+ var self = $Delegator = $klass($base, $super, 'Delegator', $Delegator);
52544
+
52545
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Delegator_initialize_1, TMP_Delegator_method_missing_2;
52546
+
52547
+
52548
+
52549
+ Opal.defn(self, '$initialize', TMP_Delegator_initialize_1 = function $$initialize(obj) {
52550
+ var self = this;
52551
+
52552
+ return self.$__setobj__(obj)
52553
+ }, TMP_Delegator_initialize_1.$$arity = 1);
52554
+ return (Opal.defn(self, '$method_missing', TMP_Delegator_method_missing_2 = function $$method_missing(m, $a_rest) {
52555
+ var self = this, args, $iter = TMP_Delegator_method_missing_2.$$p, block = $iter || nil, target = nil;
52556
+
52557
+ var $args_len = arguments.length, $rest_len = $args_len - 1;
52558
+ if ($rest_len < 0) { $rest_len = 0; }
52559
+ args = new Array($rest_len);
52560
+ for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) {
52561
+ args[$arg_idx - 1] = arguments[$arg_idx];
52562
+ }
52563
+ if ($iter) TMP_Delegator_method_missing_2.$$p = null;
52564
+
52565
+ target = self.$__getobj__();
52566
+ if ($truthy(target['$respond_to?'](m))) {
52567
+ return $send(target, '__send__', [m].concat(Opal.to_a(args)), block.$to_proc())
52568
+ } else {
52569
+ return $send(self, Opal.find_super_dispatcher(self, 'method_missing', TMP_Delegator_method_missing_2, false), [m].concat(Opal.to_a(args)), block.$to_proc())
52570
+ };
52571
+ }, TMP_Delegator_method_missing_2.$$arity = -2), nil) && 'method_missing';
52572
+ })($nesting[0], Opal.const_get_relative($nesting, 'BasicObject'), $nesting);
52573
+ (function($base, $super, $parent_nesting) {
52574
+ function $SimpleDelegator(){};
52575
+ var self = $SimpleDelegator = $klass($base, $super, 'SimpleDelegator', $SimpleDelegator);
52576
+
52577
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_SimpleDelegator___getobj___3, TMP_SimpleDelegator___setobj___4;
52578
+
52579
+ def.delegate_sd_obj = nil;
52580
+
52581
+
52582
+ Opal.defn(self, '$__getobj__', TMP_SimpleDelegator___getobj___3 = function $$__getobj__() {
52583
+ var self = this;
52584
+
52585
+ return self.delegate_sd_obj
52586
+ }, TMP_SimpleDelegator___getobj___3.$$arity = 0);
52587
+ return (Opal.defn(self, '$__setobj__', TMP_SimpleDelegator___setobj___4 = function $$__setobj__(obj) {
52588
+ var self = this;
52589
+
52590
+ return (self.delegate_sd_obj = obj)
52591
+ }, TMP_SimpleDelegator___setobj___4.$$arity = 1), nil) && '__setobj__';
52592
+ })($nesting[0], Opal.const_get_relative($nesting, 'Delegator'), $nesting);
52593
+ return (Opal.defn(Opal.Object, '$DelegateClass', TMP_DelegateClass_5 = function $$DelegateClass(superklass) {
52594
+ var self = this;
52595
+
52596
+ return Opal.const_get_relative($nesting, 'SimpleDelegator')
52597
+ }, TMP_DelegateClass_5.$$arity = 1), nil) && 'DelegateClass';
52598
+ };
52599
+
52600
+ /* Generated by Opal 0.11.0 */
52601
+ Opal.modules["forwardable"] = function(Opal) {
52602
+ var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy;
52603
+
52604
+ Opal.add_stubs(['$each', '$respond_to?', '$def_instance_delegator', '$include?', '$start_with?', '$to_s', '$define_method', '$__send__', '$instance_variable_get', '$to_proc', '$def_single_delegator', '$define_singleton_method']);
52605
+
52606
+ (function($base, $parent_nesting) {
52607
+ var $Forwardable, self = $Forwardable = $module($base, 'Forwardable');
52608
+
52609
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Forwardable_instance_delegate_3, TMP_Forwardable_def_instance_delegators_5, TMP_Forwardable_def_instance_delegator_8;
52610
+
52611
+
52612
+
52613
+ Opal.defn(self, '$instance_delegate', TMP_Forwardable_instance_delegate_3 = function $$instance_delegate(hash) {
52614
+ var TMP_1, self = this;
52615
+
52616
+ return $send(hash, 'each', [], (TMP_1 = function(methods, accessor){var self = TMP_1.$$s || this, TMP_2;
52617
+ if (methods == null) methods = nil;if (accessor == null) accessor = nil;
52618
+
52619
+ if ($truthy(methods['$respond_to?']("each"))) {
52620
+ } else {
52621
+ methods = [methods]
52622
+ };
52623
+ return $send(methods, 'each', [], (TMP_2 = function(method){var self = TMP_2.$$s || this;
52624
+ if (method == null) method = nil;
52625
+ return self.$def_instance_delegator(accessor, method)}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2));}, TMP_1.$$s = self, TMP_1.$$arity = 2, TMP_1))
52626
+ }, TMP_Forwardable_instance_delegate_3.$$arity = 1);
52627
+
52628
+ Opal.defn(self, '$def_instance_delegators', TMP_Forwardable_def_instance_delegators_5 = function $$def_instance_delegators(accessor, $a_rest) {
52629
+ var TMP_4, self = this, methods;
52630
+
52631
+ var $args_len = arguments.length, $rest_len = $args_len - 1;
52632
+ if ($rest_len < 0) { $rest_len = 0; }
52633
+ methods = new Array($rest_len);
52634
+ for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) {
52635
+ methods[$arg_idx - 1] = arguments[$arg_idx];
52636
+ }
52637
+ return $send(methods, 'each', [], (TMP_4 = function(method){var self = TMP_4.$$s || this;
52638
+ if (method == null) method = nil;
52639
+
52640
+ if ($truthy(["__send__", "__id__"]['$include?'](method))) {
52641
+ return nil;};
52642
+ return self.$def_instance_delegator(accessor, method);}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4))
52643
+ }, TMP_Forwardable_def_instance_delegators_5.$$arity = -2);
52644
+
52645
+ Opal.defn(self, '$def_instance_delegator', TMP_Forwardable_def_instance_delegator_8 = function $$def_instance_delegator(accessor, method, ali) {
52646
+ var TMP_6, TMP_7, self = this;
52647
+
52648
+ if (ali == null) {
52649
+ ali = method;
52650
+ }
52651
+ if ($truthy(accessor.$to_s()['$start_with?']("@"))) {
52652
+ return $send(self, 'define_method', [ali], (TMP_6 = function($a_rest){var self = TMP_6.$$s || this, block, args;
52653
+
52654
+ block = TMP_6.$$p || nil;
52655
+ if (block) TMP_6.$$p = null;
52656
+ var $args_len = arguments.length, $rest_len = $args_len - 0;
52657
+ if ($rest_len < 0) { $rest_len = 0; }
52658
+ args = new Array($rest_len);
52659
+ for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
52660
+ args[$arg_idx - 0] = arguments[$arg_idx];
52661
+ }
52662
+ return $send(self.$instance_variable_get(accessor), '__send__', [method].concat(Opal.to_a(args)), block.$to_proc())}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6))
52663
+ } else {
52664
+ return $send(self, 'define_method', [ali], (TMP_7 = function($a_rest){var self = TMP_7.$$s || this, block, args;
52665
+
52666
+ block = TMP_7.$$p || nil;
52667
+ if (block) TMP_7.$$p = null;
52668
+ var $args_len = arguments.length, $rest_len = $args_len - 0;
52669
+ if ($rest_len < 0) { $rest_len = 0; }
52670
+ args = new Array($rest_len);
52671
+ for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
52672
+ args[$arg_idx - 0] = arguments[$arg_idx];
52673
+ }
52674
+ return $send(self.$__send__(accessor), '__send__', [method].concat(Opal.to_a(args)), block.$to_proc())}, TMP_7.$$s = self, TMP_7.$$arity = -1, TMP_7))
52675
+ }
52676
+ }, TMP_Forwardable_def_instance_delegator_8.$$arity = -3);
52677
+ Opal.alias(self, "delegate", "instance_delegate");
52678
+ Opal.alias(self, "def_delegators", "def_instance_delegators");
52679
+ Opal.alias(self, "def_delegator", "def_instance_delegator");
52680
+ })($nesting[0], $nesting);
52681
+ return (function($base, $parent_nesting) {
52682
+ var $SingleForwardable, self = $SingleForwardable = $module($base, 'SingleForwardable');
52683
+
52684
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_SingleForwardable_single_delegate_11, TMP_SingleForwardable_def_single_delegators_13, TMP_SingleForwardable_def_single_delegator_16;
52685
+
52686
+
52687
+
52688
+ Opal.defn(self, '$single_delegate', TMP_SingleForwardable_single_delegate_11 = function $$single_delegate(hash) {
52689
+ var TMP_9, self = this;
52690
+
52691
+ return $send(hash, 'each', [], (TMP_9 = function(methods, accessor){var self = TMP_9.$$s || this, TMP_10;
52692
+ if (methods == null) methods = nil;if (accessor == null) accessor = nil;
52693
+
52694
+ if ($truthy(methods['$respond_to?']("each"))) {
52695
+ } else {
52696
+ methods = [methods]
52697
+ };
52698
+ return $send(methods, 'each', [], (TMP_10 = function(method){var self = TMP_10.$$s || this;
52699
+ if (method == null) method = nil;
52700
+ return self.$def_single_delegator(accessor, method)}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10));}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9))
52701
+ }, TMP_SingleForwardable_single_delegate_11.$$arity = 1);
52702
+
52703
+ Opal.defn(self, '$def_single_delegators', TMP_SingleForwardable_def_single_delegators_13 = function $$def_single_delegators(accessor, $a_rest) {
52704
+ var TMP_12, self = this, methods;
52705
+
52706
+ var $args_len = arguments.length, $rest_len = $args_len - 1;
52707
+ if ($rest_len < 0) { $rest_len = 0; }
52708
+ methods = new Array($rest_len);
52709
+ for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) {
52710
+ methods[$arg_idx - 1] = arguments[$arg_idx];
52711
+ }
52712
+ return $send(methods, 'each', [], (TMP_12 = function(method){var self = TMP_12.$$s || this;
52713
+ if (method == null) method = nil;
52714
+
52715
+ if ($truthy(["__send__", "__id__"]['$include?'](method))) {
52716
+ return nil;};
52717
+ return self.$def_single_delegator(accessor, method);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12))
52718
+ }, TMP_SingleForwardable_def_single_delegators_13.$$arity = -2);
52719
+
52720
+ Opal.defn(self, '$def_single_delegator', TMP_SingleForwardable_def_single_delegator_16 = function $$def_single_delegator(accessor, method, ali) {
52721
+ var TMP_14, TMP_15, self = this;
52722
+
52723
+ if (ali == null) {
52724
+ ali = method;
52725
+ }
52726
+ if ($truthy(accessor.$to_s()['$start_with?']("@"))) {
52727
+ return $send(self, 'define_singleton_method', [ali], (TMP_14 = function($a_rest){var self = TMP_14.$$s || this, block, args;
52728
+
52729
+ block = TMP_14.$$p || nil;
52730
+ if (block) TMP_14.$$p = null;
52731
+ var $args_len = arguments.length, $rest_len = $args_len - 0;
52732
+ if ($rest_len < 0) { $rest_len = 0; }
52733
+ args = new Array($rest_len);
52734
+ for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
52735
+ args[$arg_idx - 0] = arguments[$arg_idx];
52736
+ }
52737
+ return $send(self.$instance_variable_get(accessor), '__send__', [method].concat(Opal.to_a(args)), block.$to_proc())}, TMP_14.$$s = self, TMP_14.$$arity = -1, TMP_14))
52738
+ } else {
52739
+ return $send(self, 'define_singleton_method', [ali], (TMP_15 = function($a_rest){var self = TMP_15.$$s || this, block, args;
52740
+
52741
+ block = TMP_15.$$p || nil;
52742
+ if (block) TMP_15.$$p = null;
52743
+ var $args_len = arguments.length, $rest_len = $args_len - 0;
52744
+ if ($rest_len < 0) { $rest_len = 0; }
52745
+ args = new Array($rest_len);
52746
+ for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
52747
+ args[$arg_idx - 0] = arguments[$arg_idx];
52748
+ }
52749
+ return $send(self.$__send__(accessor), '__send__', [method].concat(Opal.to_a(args)), block.$to_proc())}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15))
52750
+ }
52751
+ }, TMP_SingleForwardable_def_single_delegator_16.$$arity = -3);
52752
+ Opal.alias(self, "delegate", "single_delegate");
52753
+ Opal.alias(self, "def_delegators", "def_single_delegators");
52754
+ Opal.alias(self, "def_delegator", "def_single_delegator");
52755
+ })($nesting[0], $nesting);
52756
+ };
52757
+
52407
52758
  /* Generated by Opal 0.11.0 */
52408
52759
  Opal.modules["pp"] = function(Opal) {
52409
52760
  function $rb_le(lhs, rhs) {
@@ -52498,6 +52849,549 @@ if (obj == null) obj = nil;
52498
52849
  })($nesting[0], null, $nesting);
52499
52850
  };
52500
52851
 
52852
+ /* Generated by Opal 0.11.0 */
52853
+ Opal.modules["promise"] = function(Opal) {
52854
+ function $rb_plus(lhs, rhs) {
52855
+ return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
52856
+ }
52857
+ function $rb_le(lhs, rhs) {
52858
+ return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs);
52859
+ }
52860
+ function $rb_minus(lhs, rhs) {
52861
+ return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
52862
+ }
52863
+ var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
52864
+
52865
+ Opal.add_stubs(['$resolve', '$new', '$reject', '$attr_reader', '$===', '$value', '$has_key?', '$keys', '$!', '$==', '$<<', '$>>', '$exception?', '$[]', '$resolved?', '$rejected?', '$error', '$include?', '$action', '$realized?', '$raise', '$^', '$call', '$resolve!', '$exception!', '$any?', '$each', '$reject!', '$there_can_be_only_one!', '$then', '$to_proc', '$fail', '$always', '$trace', '$class', '$object_id', '$+', '$inspect', '$act?', '$nil?', '$prev', '$push', '$concat', '$it', '$proc', '$reverse', '$pop', '$<=', '$length', '$shift', '$-', '$wait', '$map', '$reduce', '$try', '$tap', '$all?', '$find']);
52866
+ return (function($base, $super, $parent_nesting) {
52867
+ function $Promise(){};
52868
+ var self = $Promise = $klass($base, $super, 'Promise', $Promise);
52869
+
52870
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Promise_value_1, TMP_Promise_error_2, TMP_Promise_when_3, TMP_Promise_initialize_4, TMP_Promise_value_5, TMP_Promise_act$q_6, TMP_Promise_action_7, TMP_Promise_exception$q_8, TMP_Promise_realized$q_9, TMP_Promise_resolved$q_10, TMP_Promise_rejected$q_11, TMP_Promise_$_12, TMP_Promise_$lt$lt_13, TMP_Promise_$gt$gt_14, TMP_Promise_resolve_15, TMP_Promise_resolve$B_17, TMP_Promise_reject_18, TMP_Promise_reject$B_20, TMP_Promise_exception$B_21, TMP_Promise_then_22, TMP_Promise_then$B_23, TMP_Promise_fail_24, TMP_Promise_fail$B_25, TMP_Promise_always_26, TMP_Promise_always$B_27, TMP_Promise_trace_28, TMP_Promise_trace$B_29, TMP_Promise_there_can_be_only_one$B_30, TMP_Promise_inspect_31;
52871
+
52872
+ def.value = def.action = def.exception = def.realized = def.next = def.delayed = def.error = def.prev = nil;
52873
+
52874
+ Opal.defs(self, '$value', TMP_Promise_value_1 = function $$value(value) {
52875
+ var self = this;
52876
+
52877
+ return self.$new().$resolve(value)
52878
+ }, TMP_Promise_value_1.$$arity = 1);
52879
+ Opal.defs(self, '$error', TMP_Promise_error_2 = function $$error(value) {
52880
+ var self = this;
52881
+
52882
+ return self.$new().$reject(value)
52883
+ }, TMP_Promise_error_2.$$arity = 1);
52884
+ Opal.defs(self, '$when', TMP_Promise_when_3 = function $$when($a_rest) {
52885
+ var self = this, promises;
52886
+
52887
+ var $args_len = arguments.length, $rest_len = $args_len - 0;
52888
+ if ($rest_len < 0) { $rest_len = 0; }
52889
+ promises = new Array($rest_len);
52890
+ for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
52891
+ promises[$arg_idx - 0] = arguments[$arg_idx];
52892
+ }
52893
+ return Opal.const_get_relative($nesting, 'When').$new(promises)
52894
+ }, TMP_Promise_when_3.$$arity = -1);
52895
+ self.$attr_reader("error", "prev", "next");
52896
+
52897
+ Opal.defn(self, '$initialize', TMP_Promise_initialize_4 = function $$initialize(action) {
52898
+ var self = this;
52899
+
52900
+ if (action == null) {
52901
+ action = $hash2([], {});
52902
+ }
52903
+
52904
+ self.action = action;
52905
+ self.realized = false;
52906
+ self.exception = false;
52907
+ self.value = nil;
52908
+ self.error = nil;
52909
+ self.delayed = false;
52910
+ self.prev = nil;
52911
+ return (self.next = []);
52912
+ }, TMP_Promise_initialize_4.$$arity = -1);
52913
+
52914
+ Opal.defn(self, '$value', TMP_Promise_value_5 = function $$value() {
52915
+ var self = this;
52916
+
52917
+ if ($truthy(Opal.const_get_relative($nesting, 'Promise')['$==='](self.value))) {
52918
+ return self.value.$value()
52919
+ } else {
52920
+ return self.value
52921
+ }
52922
+ }, TMP_Promise_value_5.$$arity = 0);
52923
+
52924
+ Opal.defn(self, '$act?', TMP_Promise_act$q_6 = function() {
52925
+ var $a, self = this;
52926
+
52927
+ return ($truthy($a = self.action['$has_key?']("success")) ? $a : self.action['$has_key?']("always"))
52928
+ }, TMP_Promise_act$q_6.$$arity = 0);
52929
+
52930
+ Opal.defn(self, '$action', TMP_Promise_action_7 = function $$action() {
52931
+ var self = this;
52932
+
52933
+ return self.action.$keys()
52934
+ }, TMP_Promise_action_7.$$arity = 0);
52935
+
52936
+ Opal.defn(self, '$exception?', TMP_Promise_exception$q_8 = function() {
52937
+ var self = this;
52938
+
52939
+ return self.exception
52940
+ }, TMP_Promise_exception$q_8.$$arity = 0);
52941
+
52942
+ Opal.defn(self, '$realized?', TMP_Promise_realized$q_9 = function() {
52943
+ var self = this;
52944
+
52945
+ return self.realized['$!']()['$!']()
52946
+ }, TMP_Promise_realized$q_9.$$arity = 0);
52947
+
52948
+ Opal.defn(self, '$resolved?', TMP_Promise_resolved$q_10 = function() {
52949
+ var self = this;
52950
+
52951
+ return self.realized['$==']("resolve")
52952
+ }, TMP_Promise_resolved$q_10.$$arity = 0);
52953
+
52954
+ Opal.defn(self, '$rejected?', TMP_Promise_rejected$q_11 = function() {
52955
+ var self = this;
52956
+
52957
+ return self.realized['$==']("reject")
52958
+ }, TMP_Promise_rejected$q_11.$$arity = 0);
52959
+
52960
+ Opal.defn(self, '$^', TMP_Promise_$_12 = function(promise) {
52961
+ var self = this;
52962
+
52963
+
52964
+ promise['$<<'](self);
52965
+ self['$>>'](promise);
52966
+ return promise;
52967
+ }, TMP_Promise_$_12.$$arity = 1);
52968
+
52969
+ Opal.defn(self, '$<<', TMP_Promise_$lt$lt_13 = function(promise) {
52970
+ var self = this;
52971
+
52972
+
52973
+ self.prev = promise;
52974
+ return self;
52975
+ }, TMP_Promise_$lt$lt_13.$$arity = 1);
52976
+
52977
+ Opal.defn(self, '$>>', TMP_Promise_$gt$gt_14 = function(promise) {
52978
+ var $a, self = this;
52979
+
52980
+
52981
+ self.next['$<<'](promise);
52982
+ if ($truthy(self['$exception?']())) {
52983
+ promise.$reject(self.delayed['$[]'](0))
52984
+ } else if ($truthy(self['$resolved?']())) {
52985
+ promise.$resolve((function() {if ($truthy(self.delayed)) {
52986
+ return self.delayed['$[]'](0)
52987
+ } else {
52988
+ return self.$value()
52989
+ }; return nil; })())
52990
+ } else if ($truthy(self['$rejected?']())) {
52991
+ if ($truthy(($truthy($a = self.action['$has_key?']("failure")['$!']()) ? $a : Opal.const_get_relative($nesting, 'Promise')['$===']((function() {if ($truthy(self.delayed)) {
52992
+ return self.delayed['$[]'](0)
52993
+ } else {
52994
+ return self.error
52995
+ }; return nil; })())))) {
52996
+ promise.$reject((function() {if ($truthy(self.delayed)) {
52997
+ return self.delayed['$[]'](0)
52998
+ } else {
52999
+ return self.$error()
53000
+ }; return nil; })())
53001
+ } else if ($truthy(promise.$action()['$include?']("always"))) {
53002
+ promise.$reject((function() {if ($truthy(self.delayed)) {
53003
+ return self.delayed['$[]'](0)
53004
+ } else {
53005
+ return self.$error()
53006
+ }; return nil; })())}};
53007
+ return self;
53008
+ }, TMP_Promise_$gt$gt_14.$$arity = 1);
53009
+
53010
+ Opal.defn(self, '$resolve', TMP_Promise_resolve_15 = function $$resolve(value) {
53011
+ var $a, self = this, block = nil, e = nil;
53012
+
53013
+ if (value == null) {
53014
+ value = nil;
53015
+ }
53016
+
53017
+ if ($truthy(self['$realized?']())) {
53018
+ self.$raise(Opal.const_get_relative($nesting, 'ArgumentError'), "the promise has already been realized")};
53019
+ if ($truthy(Opal.const_get_relative($nesting, 'Promise')['$==='](value))) {
53020
+ return value['$<<'](self.prev)['$^'](self)};
53021
+
53022
+ try {
53023
+
53024
+ if ($truthy((block = ($truthy($a = self.action['$[]']("success")) ? $a : self.action['$[]']("always"))))) {
53025
+ value = block.$call(value)};
53026
+ self['$resolve!'](value);
53027
+ } catch ($err) {
53028
+ if (Opal.rescue($err, [Opal.const_get_relative($nesting, 'Exception')])) {e = $err;
53029
+ try {
53030
+ self['$exception!'](e)
53031
+ } finally { Opal.pop_exception() }
53032
+ } else { throw $err; }
53033
+ };;
53034
+ return self;
53035
+ }, TMP_Promise_resolve_15.$$arity = -1);
53036
+
53037
+ Opal.defn(self, '$resolve!', TMP_Promise_resolve$B_17 = function(value) {
53038
+ var TMP_16, self = this;
53039
+
53040
+
53041
+ self.realized = "resolve";
53042
+ self.value = value;
53043
+ if ($truthy(self.next['$any?']())) {
53044
+ return $send(self.next, 'each', [], (TMP_16 = function(p){var self = TMP_16.$$s || this;
53045
+ if (p == null) p = nil;
53046
+ return p.$resolve(value)}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16))
53047
+ } else {
53048
+ return (self.delayed = [value])
53049
+ };
53050
+ }, TMP_Promise_resolve$B_17.$$arity = 1);
53051
+
53052
+ Opal.defn(self, '$reject', TMP_Promise_reject_18 = function $$reject(value) {
53053
+ var $a, self = this, block = nil, e = nil;
53054
+
53055
+ if (value == null) {
53056
+ value = nil;
53057
+ }
53058
+
53059
+ if ($truthy(self['$realized?']())) {
53060
+ self.$raise(Opal.const_get_relative($nesting, 'ArgumentError'), "the promise has already been realized")};
53061
+ if ($truthy(Opal.const_get_relative($nesting, 'Promise')['$==='](value))) {
53062
+ return value['$<<'](self.prev)['$^'](self)};
53063
+
53064
+ try {
53065
+
53066
+ if ($truthy((block = ($truthy($a = self.action['$[]']("failure")) ? $a : self.action['$[]']("always"))))) {
53067
+ value = block.$call(value)};
53068
+ if ($truthy(self.action['$has_key?']("always"))) {
53069
+ self['$resolve!'](value)
53070
+ } else {
53071
+ self['$reject!'](value)
53072
+ };
53073
+ } catch ($err) {
53074
+ if (Opal.rescue($err, [Opal.const_get_relative($nesting, 'Exception')])) {e = $err;
53075
+ try {
53076
+ self['$exception!'](e)
53077
+ } finally { Opal.pop_exception() }
53078
+ } else { throw $err; }
53079
+ };;
53080
+ return self;
53081
+ }, TMP_Promise_reject_18.$$arity = -1);
53082
+
53083
+ Opal.defn(self, '$reject!', TMP_Promise_reject$B_20 = function(value) {
53084
+ var TMP_19, self = this;
53085
+
53086
+
53087
+ self.realized = "reject";
53088
+ self.error = value;
53089
+ if ($truthy(self.next['$any?']())) {
53090
+ return $send(self.next, 'each', [], (TMP_19 = function(p){var self = TMP_19.$$s || this;
53091
+ if (p == null) p = nil;
53092
+ return p.$reject(value)}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19))
53093
+ } else {
53094
+ return (self.delayed = [value])
53095
+ };
53096
+ }, TMP_Promise_reject$B_20.$$arity = 1);
53097
+
53098
+ Opal.defn(self, '$exception!', TMP_Promise_exception$B_21 = function(error) {
53099
+ var self = this;
53100
+
53101
+
53102
+ self.exception = true;
53103
+ return self['$reject!'](error);
53104
+ }, TMP_Promise_exception$B_21.$$arity = 1);
53105
+
53106
+ Opal.defn(self, '$then', TMP_Promise_then_22 = function $$then() {
53107
+ var self = this, $iter = TMP_Promise_then_22.$$p, block = $iter || nil;
53108
+
53109
+ if ($iter) TMP_Promise_then_22.$$p = null;
53110
+ return self['$^'](Opal.const_get_relative($nesting, 'Promise').$new($hash2(["success"], {"success": block})))
53111
+ }, TMP_Promise_then_22.$$arity = 0);
53112
+
53113
+ Opal.defn(self, '$then!', TMP_Promise_then$B_23 = function() {
53114
+ var self = this, $iter = TMP_Promise_then$B_23.$$p, block = $iter || nil;
53115
+
53116
+ if ($iter) TMP_Promise_then$B_23.$$p = null;
53117
+
53118
+ self['$there_can_be_only_one!']();
53119
+ return $send(self, 'then', [], block.$to_proc());
53120
+ }, TMP_Promise_then$B_23.$$arity = 0);
53121
+ Opal.alias(self, "do", "then");
53122
+ Opal.alias(self, "do!", "then!");
53123
+
53124
+ Opal.defn(self, '$fail', TMP_Promise_fail_24 = function $$fail() {
53125
+ var self = this, $iter = TMP_Promise_fail_24.$$p, block = $iter || nil;
53126
+
53127
+ if ($iter) TMP_Promise_fail_24.$$p = null;
53128
+ return self['$^'](Opal.const_get_relative($nesting, 'Promise').$new($hash2(["failure"], {"failure": block})))
53129
+ }, TMP_Promise_fail_24.$$arity = 0);
53130
+
53131
+ Opal.defn(self, '$fail!', TMP_Promise_fail$B_25 = function() {
53132
+ var self = this, $iter = TMP_Promise_fail$B_25.$$p, block = $iter || nil;
53133
+
53134
+ if ($iter) TMP_Promise_fail$B_25.$$p = null;
53135
+
53136
+ self['$there_can_be_only_one!']();
53137
+ return $send(self, 'fail', [], block.$to_proc());
53138
+ }, TMP_Promise_fail$B_25.$$arity = 0);
53139
+ Opal.alias(self, "rescue", "fail");
53140
+ Opal.alias(self, "catch", "fail");
53141
+ Opal.alias(self, "rescue!", "fail!");
53142
+ Opal.alias(self, "catch!", "fail!");
53143
+
53144
+ Opal.defn(self, '$always', TMP_Promise_always_26 = function $$always() {
53145
+ var self = this, $iter = TMP_Promise_always_26.$$p, block = $iter || nil;
53146
+
53147
+ if ($iter) TMP_Promise_always_26.$$p = null;
53148
+ return self['$^'](Opal.const_get_relative($nesting, 'Promise').$new($hash2(["always"], {"always": block})))
53149
+ }, TMP_Promise_always_26.$$arity = 0);
53150
+
53151
+ Opal.defn(self, '$always!', TMP_Promise_always$B_27 = function() {
53152
+ var self = this, $iter = TMP_Promise_always$B_27.$$p, block = $iter || nil;
53153
+
53154
+ if ($iter) TMP_Promise_always$B_27.$$p = null;
53155
+
53156
+ self['$there_can_be_only_one!']();
53157
+ return $send(self, 'always', [], block.$to_proc());
53158
+ }, TMP_Promise_always$B_27.$$arity = 0);
53159
+ Opal.alias(self, "finally", "always");
53160
+ Opal.alias(self, "ensure", "always");
53161
+ Opal.alias(self, "finally!", "always!");
53162
+ Opal.alias(self, "ensure!", "always!");
53163
+
53164
+ Opal.defn(self, '$trace', TMP_Promise_trace_28 = function $$trace(depth) {
53165
+ var self = this, $iter = TMP_Promise_trace_28.$$p, block = $iter || nil;
53166
+
53167
+ if (depth == null) {
53168
+ depth = nil;
53169
+ }
53170
+ if ($iter) TMP_Promise_trace_28.$$p = null;
53171
+ return self['$^'](Opal.const_get_relative($nesting, 'Trace').$new(depth, block))
53172
+ }, TMP_Promise_trace_28.$$arity = -1);
53173
+
53174
+ Opal.defn(self, '$trace!', TMP_Promise_trace$B_29 = function($a_rest) {
53175
+ var self = this, args, $iter = TMP_Promise_trace$B_29.$$p, block = $iter || nil;
53176
+
53177
+ var $args_len = arguments.length, $rest_len = $args_len - 0;
53178
+ if ($rest_len < 0) { $rest_len = 0; }
53179
+ args = new Array($rest_len);
53180
+ for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
53181
+ args[$arg_idx - 0] = arguments[$arg_idx];
53182
+ }
53183
+ if ($iter) TMP_Promise_trace$B_29.$$p = null;
53184
+
53185
+ self['$there_can_be_only_one!']();
53186
+ return $send(self, 'trace', Opal.to_a(args), block.$to_proc());
53187
+ }, TMP_Promise_trace$B_29.$$arity = -1);
53188
+
53189
+ Opal.defn(self, '$there_can_be_only_one!', TMP_Promise_there_can_be_only_one$B_30 = function() {
53190
+ var self = this;
53191
+
53192
+ if ($truthy(self.next['$any?']())) {
53193
+ return self.$raise(Opal.const_get_relative($nesting, 'ArgumentError'), "a promise has already been chained")
53194
+ } else {
53195
+ return nil
53196
+ }
53197
+ }, TMP_Promise_there_can_be_only_one$B_30.$$arity = 0);
53198
+
53199
+ Opal.defn(self, '$inspect', TMP_Promise_inspect_31 = function $$inspect() {
53200
+ var $a, self = this, result = nil;
53201
+
53202
+
53203
+ result = "" + "#<" + (self.$class()) + "(" + (self.$object_id()) + ")";
53204
+ if ($truthy(self.next['$any?']())) {
53205
+ result = $rb_plus(result, "" + " >> " + (self.next.$inspect()))};
53206
+ if ($truthy(self['$realized?']())) {
53207
+ result = $rb_plus(result, "" + ": " + (($truthy($a = self.value) ? $a : self.error).$inspect()) + ">")
53208
+ } else {
53209
+ result = $rb_plus(result, ">")
53210
+ };
53211
+ return result;
53212
+ }, TMP_Promise_inspect_31.$$arity = 0);
53213
+ (function($base, $super, $parent_nesting) {
53214
+ function $Trace(){};
53215
+ var self = $Trace = $klass($base, $super, 'Trace', $Trace);
53216
+
53217
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Trace_it_32, TMP_Trace_initialize_33;
53218
+
53219
+
53220
+ Opal.defs(self, '$it', TMP_Trace_it_32 = function $$it(promise) {
53221
+ var $a, self = this, current = nil, prev = nil;
53222
+
53223
+
53224
+ current = [];
53225
+ if ($truthy(($truthy($a = promise['$act?']()) ? $a : promise.$prev()['$nil?']()))) {
53226
+ current.$push(promise.$value())};
53227
+ if ($truthy((prev = promise.$prev()))) {
53228
+ return current.$concat(self.$it(prev))
53229
+ } else {
53230
+ return current
53231
+ };
53232
+ }, TMP_Trace_it_32.$$arity = 1);
53233
+ return (Opal.defn(self, '$initialize', TMP_Trace_initialize_33 = function $$initialize(depth, block) {
53234
+ var TMP_34, self = this, $iter = TMP_Trace_initialize_33.$$p, $yield = $iter || nil;
53235
+
53236
+ if ($iter) TMP_Trace_initialize_33.$$p = null;
53237
+
53238
+ self.depth = depth;
53239
+ return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Trace_initialize_33, false), [$hash2(["success"], {"success": $send(self, 'proc', [], (TMP_34 = function(){var self = TMP_34.$$s || this, $a, trace = nil;
53240
+
53241
+
53242
+ trace = Opal.const_get_relative($nesting, 'Trace').$it(self).$reverse();
53243
+ trace.$pop();
53244
+ if ($truthy(($truthy($a = depth) ? $rb_le(depth, trace.$length()) : $a))) {
53245
+ trace.$shift($rb_minus(trace.$length(), depth))};
53246
+ return $send(block, 'call', Opal.to_a(trace));}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34))})], null);
53247
+ }, TMP_Trace_initialize_33.$$arity = 2), nil) && 'initialize';
53248
+ })($nesting[0], self, $nesting);
53249
+ return (function($base, $super, $parent_nesting) {
53250
+ function $When(){};
53251
+ var self = $When = $klass($base, $super, 'When', $When);
53252
+
53253
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_When_initialize_35, TMP_When_each_37, TMP_When_collect_39, TMP_When_inject_41, TMP_When_wait_44, TMP_When_$gt$gt_45, TMP_When_try_47;
53254
+
53255
+ def.wait = nil;
53256
+
53257
+
53258
+ Opal.defn(self, '$initialize', TMP_When_initialize_35 = function $$initialize(promises) {
53259
+ var TMP_36, self = this, $iter = TMP_When_initialize_35.$$p, $yield = $iter || nil;
53260
+
53261
+ if (promises == null) {
53262
+ promises = [];
53263
+ }
53264
+ if ($iter) TMP_When_initialize_35.$$p = null;
53265
+
53266
+ $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_When_initialize_35, false), [], null);
53267
+ self.wait = [];
53268
+ return $send(promises, 'each', [], (TMP_36 = function(promise){var self = TMP_36.$$s || this;
53269
+ if (promise == null) promise = nil;
53270
+ return self.$wait(promise)}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36));
53271
+ }, TMP_When_initialize_35.$$arity = -1);
53272
+
53273
+ Opal.defn(self, '$each', TMP_When_each_37 = function $$each() {
53274
+ var TMP_38, self = this, $iter = TMP_When_each_37.$$p, block = $iter || nil;
53275
+
53276
+ if ($iter) TMP_When_each_37.$$p = null;
53277
+
53278
+ if ($truthy(block)) {
53279
+ } else {
53280
+ self.$raise(Opal.const_get_relative($nesting, 'ArgumentError'), "no block given")
53281
+ };
53282
+ return $send(self, 'then', [], (TMP_38 = function(values){var self = TMP_38.$$s || this;
53283
+ if (values == null) values = nil;
53284
+ return $send(values, 'each', [], block.$to_proc())}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38));
53285
+ }, TMP_When_each_37.$$arity = 0);
53286
+
53287
+ Opal.defn(self, '$collect', TMP_When_collect_39 = function $$collect() {
53288
+ var TMP_40, self = this, $iter = TMP_When_collect_39.$$p, block = $iter || nil;
53289
+
53290
+ if ($iter) TMP_When_collect_39.$$p = null;
53291
+
53292
+ if ($truthy(block)) {
53293
+ } else {
53294
+ self.$raise(Opal.const_get_relative($nesting, 'ArgumentError'), "no block given")
53295
+ };
53296
+ return $send(self, 'then', [], (TMP_40 = function(values){var self = TMP_40.$$s || this;
53297
+ if (values == null) values = nil;
53298
+ return Opal.const_get_relative($nesting, 'When').$new($send(values, 'map', [], block.$to_proc()))}, TMP_40.$$s = self, TMP_40.$$arity = 1, TMP_40));
53299
+ }, TMP_When_collect_39.$$arity = 0);
53300
+
53301
+ Opal.defn(self, '$inject', TMP_When_inject_41 = function $$inject($a_rest) {
53302
+ var TMP_42, self = this, args, $iter = TMP_When_inject_41.$$p, block = $iter || nil;
53303
+
53304
+ var $args_len = arguments.length, $rest_len = $args_len - 0;
53305
+ if ($rest_len < 0) { $rest_len = 0; }
53306
+ args = new Array($rest_len);
53307
+ for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
53308
+ args[$arg_idx - 0] = arguments[$arg_idx];
53309
+ }
53310
+ if ($iter) TMP_When_inject_41.$$p = null;
53311
+ return $send(self, 'then', [], (TMP_42 = function(values){var self = TMP_42.$$s || this;
53312
+ if (values == null) values = nil;
53313
+ return $send(values, 'reduce', Opal.to_a(args), block.$to_proc())}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42))
53314
+ }, TMP_When_inject_41.$$arity = -1);
53315
+ Opal.alias(self, "map", "collect");
53316
+ Opal.alias(self, "reduce", "inject");
53317
+
53318
+ Opal.defn(self, '$wait', TMP_When_wait_44 = function $$wait(promise) {
53319
+ var TMP_43, self = this;
53320
+
53321
+
53322
+ if ($truthy(Opal.const_get_relative($nesting, 'Promise')['$==='](promise))) {
53323
+ } else {
53324
+ promise = Opal.const_get_relative($nesting, 'Promise').$value(promise)
53325
+ };
53326
+ if ($truthy(promise['$act?']())) {
53327
+ promise = promise.$then()};
53328
+ self.wait['$<<'](promise);
53329
+ $send(promise, 'always', [], (TMP_43 = function(){var self = TMP_43.$$s || this;
53330
+ if (self.next == null) self.next = nil;
53331
+
53332
+ if ($truthy(self.next['$any?']())) {
53333
+ return self.$try()
53334
+ } else {
53335
+ return nil
53336
+ }}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43));
53337
+ return self;
53338
+ }, TMP_When_wait_44.$$arity = 1);
53339
+ Opal.alias(self, "and", "wait");
53340
+
53341
+ Opal.defn(self, '$>>', TMP_When_$gt$gt_45 = function($a_rest) {
53342
+ var TMP_46, self = this, $iter = TMP_When_$gt$gt_45.$$p, $yield = $iter || nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
53343
+
53344
+ if ($iter) TMP_When_$gt$gt_45.$$p = null;
53345
+ // Prepare super implicit arguments
53346
+ for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
53347
+ $zuper[$zuper_i] = arguments[$zuper_i];
53348
+ }
53349
+ return $send($send(self, Opal.find_super_dispatcher(self, '>>', TMP_When_$gt$gt_45, false), $zuper, $iter), 'tap', [], (TMP_46 = function(){var self = TMP_46.$$s || this;
53350
+
53351
+ return self.$try()}, TMP_46.$$s = self, TMP_46.$$arity = 0, TMP_46))
53352
+ }, TMP_When_$gt$gt_45.$$arity = -1);
53353
+ return (Opal.defn(self, '$try', TMP_When_try_47 = function() {
53354
+ var self = this, promise = nil;
53355
+
53356
+ if ($truthy($send(self.wait, 'all?', [], "realized?".$to_proc()))) {
53357
+ if ($truthy((promise = $send(self.wait, 'find', [], "rejected?".$to_proc())))) {
53358
+ return self.$reject(promise.$error())
53359
+ } else {
53360
+ return self.$resolve($send(self.wait, 'map', [], "value".$to_proc()))
53361
+ }
53362
+ } else {
53363
+ return nil
53364
+ }
53365
+ }, TMP_When_try_47.$$arity = 0), nil) && 'try';
53366
+ })($nesting[0], self, $nesting);
53367
+ })($nesting[0], null, $nesting)
53368
+ };
53369
+
53370
+ /* Generated by Opal 0.11.0 */
53371
+ Opal.modules["time"] = function(Opal) {
53372
+ var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass;
53373
+
53374
+ Opal.add_stubs(['$strftime']);
53375
+ return (function($base, $super, $parent_nesting) {
53376
+ function $Time(){};
53377
+ var self = $Time = $klass($base, $super, 'Time', $Time);
53378
+
53379
+ var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Time_parse_1, TMP_Time_iso8601_2;
53380
+
53381
+
53382
+ Opal.defs(self, '$parse', TMP_Time_parse_1 = function $$parse(str) {
53383
+ var self = this;
53384
+
53385
+ return new Date(Date.parse(str))
53386
+ }, TMP_Time_parse_1.$$arity = 1);
53387
+ return (Opal.defn(self, '$iso8601', TMP_Time_iso8601_2 = function $$iso8601() {
53388
+ var self = this;
53389
+
53390
+ return self.$strftime("%FT%T%z")
53391
+ }, TMP_Time_iso8601_2.$$arity = 0), nil) && 'iso8601';
53392
+ })($nesting[0], null, $nesting)
53393
+ };
53394
+
52501
53395
  /* Generated by Opal 0.11.0 */
52502
53396
  (function(Opal) {
52503
53397
  function $rb_minus(lhs, rhs) {
@@ -52546,7 +53440,13 @@ if (obj == null) obj = nil;
52546
53440
  ;
52547
53441
  return self.$eval(r.responseText);
52548
53442
  }, TMP_require_remote_2.$$arity = 1);
53443
+ self.$require("singleton");
53444
+ self.$require("delegate");
53445
+ self.$require("forwardable");
52549
53446
  self.$require("pp");
53447
+ self.$require("promise");
53448
+ self.$require("set");
53449
+ self.$require("time");
52550
53450
  (function($base, $parent_nesting) {
52551
53451
  var $DXOpal, self = $DXOpal = $module($base, 'DXOpal');
52552
53452