opal 0.3.20 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. data/.gitignore +2 -7
  2. data/.rspec +2 -0
  3. data/.travis.yml +11 -0
  4. data/Gemfile +8 -2
  5. data/LICENSE +2 -3
  6. data/README.md +106 -239
  7. data/Rakefile +58 -16
  8. data/bin/opal +1 -0
  9. data/core/array.rb +180 -160
  10. data/core/basic_object.rb +8 -4
  11. data/core/boolean.rb +6 -6
  12. data/core/class.rb +9 -15
  13. data/core/dir.rb +89 -0
  14. data/core/enumerable.rb +83 -86
  15. data/core/error.rb +9 -4
  16. data/core/file.rb +85 -0
  17. data/core/hash.rb +67 -67
  18. data/core/kernel.rb +38 -42
  19. data/core/module.rb +57 -54
  20. data/core/numeric.rb +41 -41
  21. data/core/proc.rb +1 -5
  22. data/core/range.rb +11 -11
  23. data/core/regexp.rb +27 -22
  24. data/core/runtime.js +152 -221
  25. data/core/string.rb +86 -73
  26. data/core/time.rb +22 -18
  27. data/docs/post.html +9 -0
  28. data/docs/pre.html +32 -0
  29. data/lib/opal.rb +43 -3
  30. data/lib/opal/builder.rb +9 -26
  31. data/lib/opal/grammar.rb +1 -1
  32. data/lib/opal/grammar.y +1 -1
  33. data/lib/opal/lexer.rb +21 -15
  34. data/lib/opal/parser.rb +100 -111
  35. data/lib/opal/rake_task.rb +66 -0
  36. data/lib/opal/scope.rb +13 -5
  37. data/lib/opal/version.rb +1 -1
  38. data/opal.gemspec +2 -0
  39. data/spec/browser_spec.rb +28 -0
  40. data/spec/builder/lib_name_for_spec.rb +1 -6
  41. data/spec/grammar/alias_spec.rb +1 -1
  42. data/spec/grammar/and_spec.rb +1 -1
  43. data/spec/grammar/array_spec.rb +1 -1
  44. data/spec/grammar/attrasgn_spec.rb +1 -1
  45. data/spec/grammar/begin_spec.rb +1 -1
  46. data/spec/grammar/block_spec.rb +1 -1
  47. data/spec/grammar/break_spec.rb +1 -1
  48. data/spec/grammar/call_spec.rb +1 -1
  49. data/spec/grammar/class_spec.rb +1 -1
  50. data/spec/grammar/const_spec.rb +1 -1
  51. data/spec/grammar/cvar_spec.rb +1 -1
  52. data/spec/grammar/def_spec.rb +1 -1
  53. data/spec/grammar/false_spec.rb +1 -1
  54. data/spec/grammar/file_spec.rb +1 -1
  55. data/spec/grammar/gvar_spec.rb +1 -1
  56. data/spec/grammar/hash_spec.rb +1 -1
  57. data/spec/grammar/iasgn_spec.rb +1 -1
  58. data/spec/grammar/if_spec.rb +1 -1
  59. data/spec/grammar/iter_spec.rb +1 -1
  60. data/spec/grammar/ivar_spec.rb +1 -1
  61. data/spec/grammar/lambda_spec.rb +1 -1
  62. data/spec/grammar/lasgn_spec.rb +1 -1
  63. data/spec/grammar/line_spec.rb +1 -1
  64. data/spec/grammar/lvar_spec.rb +1 -1
  65. data/spec/grammar/masgn_spec.rb +1 -1
  66. data/spec/grammar/module_spec.rb +1 -1
  67. data/spec/grammar/nil_spec.rb +1 -1
  68. data/spec/grammar/not_spec.rb +1 -1
  69. data/spec/grammar/op_asgn1_spec.rb +1 -1
  70. data/spec/grammar/op_asgn2_spec.rb +1 -1
  71. data/spec/grammar/or_spec.rb +1 -1
  72. data/spec/grammar/return_spec.rb +1 -1
  73. data/spec/grammar/sclass_spec.rb +1 -1
  74. data/spec/grammar/self_spec.rb +1 -1
  75. data/spec/grammar/str_spec.rb +1 -1
  76. data/spec/grammar/super_spec.rb +1 -1
  77. data/spec/grammar/true_spec.rb +1 -1
  78. data/spec/grammar/undef_spec.rb +1 -1
  79. data/spec/grammar/unless_spec.rb +1 -1
  80. data/spec/grammar/while_spec.rb +1 -1
  81. data/spec/grammar/xstr_spec.rb +1 -1
  82. data/spec/grammar/yield_spec.rb +1 -1
  83. data/spec/spec_helper.rb +6 -1
  84. data/test/core/array/minus_spec.rb +13 -0
  85. data/test/core/enumerable/drop_while_spec.rb +0 -5
  86. data/test/core/range/case_compare_spec.rb +0 -1
  87. data/test/index.html +1 -1
  88. data/test/index.min.html +12 -0
  89. data/test/language/alias_spec.rb +0 -4
  90. data/test/language/fixtures/next.rb +62 -0
  91. data/test/language/metaclass_spec.rb +4 -4
  92. data/test/language/next_spec.rb +0 -63
  93. data/test/language/send_spec.rb +0 -5
  94. data/test/language/singleton_class_spec.rb +4 -0
  95. data/test/opal/array/subclassing_spec.rb +1 -1
  96. data/test/opal/class/bridge_class_spec.rb +2 -2
  97. data/test/opal/runtime/class_hierarchy_spec.rb +1 -2
  98. data/test/opal/runtime/method_missing_spec.rb +17 -0
  99. data/test/spec_helper.rb +4 -1
  100. metadata +32 -28
  101. data/docs/CNAME +0 -1
  102. data/docs/Rakefile +0 -55
  103. data/docs/css/styles.css +0 -50
  104. data/docs/css/syntax.css +0 -63
  105. data/docs/layout/post.html +0 -3
  106. data/docs/layout/pre.html +0 -11
  107. data/examples/dependencies/.gitignore +0 -1
  108. data/examples/dependencies/Gemfile +0 -6
  109. data/examples/dependencies/README.md +0 -41
  110. data/examples/dependencies/Rakefile +0 -10
  111. data/examples/dependencies/app.rb +0 -19
  112. data/examples/dependencies/build/.gitkeep +0 -0
  113. data/examples/dependencies/index.html +0 -13
  114. data/examples/hello_world/.gitignore +0 -1
  115. data/examples/hello_world/Gemfile +0 -3
  116. data/examples/hello_world/README.md +0 -27
  117. data/examples/hello_world/Rakefile +0 -23
  118. data/examples/hello_world/app.rb +0 -7
  119. data/examples/hello_world/index.html +0 -12
  120. data/lib/opal/builder_task.rb +0 -91
  121. data/spec/builder/build_order_spec.rb +0 -20
  122. data/test/opal/runtime/_methods_spec.rb +0 -48
@@ -3,14 +3,18 @@ class BasicObject
3
3
  end
4
4
 
5
5
  def ==(other)
6
- `this === other`
6
+ `#{self} === other`
7
7
  end
8
8
 
9
9
  def __send__(symbol, *args, &block)
10
10
  %x{
11
- var meth = this[mid_to_jsid(symbol)];
11
+ var meth = #{self}.$m[symbol];
12
12
 
13
- return meth.apply(this, args);
13
+ if (!meth) {
14
+ return #{ method_missing symbol };
15
+ }
16
+
17
+ return meth.apply(null, [#{self}].concat(args));
14
18
  }
15
19
  end
16
20
 
@@ -25,7 +29,7 @@ class BasicObject
25
29
  no_block_given();
26
30
  }
27
31
 
28
- return block.call(this, this);
32
+ return block(#{self});
29
33
  }
30
34
  end
31
35
 
@@ -4,29 +4,29 @@ class Boolean < `Boolean`
4
4
  }
5
5
 
6
6
  def &(other)
7
- `(this == true) ? (other !== false && other !== nil) : false`
7
+ `(#{self} == true) ? (other !== false && other !== nil) : false`
8
8
  end
9
9
 
10
10
  def |(other)
11
- `(this == true) ? true : (other !== false && other !== nil)`
11
+ `(#{self} == true) ? true : (other !== false && other !== nil)`
12
12
  end
13
13
 
14
14
  def ^(other)
15
- `(this == true) ? (other === false || other === nil) : (other !== false && other !== nil)`
15
+ `(#{self} == true) ? (other === false || other === nil) : (other !== false && other !== nil)`
16
16
  end
17
17
 
18
18
  def ==(other)
19
- `(this == true) === other.valueOf()`
19
+ `(#{self} == true) === other.valueOf()`
20
20
  end
21
21
 
22
22
  alias singleton_class class
23
23
 
24
24
  def to_json
25
- `this.valueOf() ? 'true' : 'false'`
25
+ `#{self}.valueOf() ? 'true' : 'false'`
26
26
  end
27
27
 
28
28
  def to_s
29
- `(this == true) ? 'true' : 'false'`
29
+ `(#{self} == true) ? 'true' : 'false'`
30
30
  end
31
31
  end
32
32
 
@@ -5,10 +5,10 @@ class Class
5
5
  var klass = boot_class(sup, AnonClass)
6
6
  klass._name = nil;
7
7
 
8
- sup.$inherited(klass);
8
+ #{ sup.inherited `klass` };
9
9
 
10
10
  if (block !== nil) {
11
- block.call(klass);
11
+ block(klass, '');
12
12
  }
13
13
 
14
14
  return klass;
@@ -17,7 +17,7 @@ class Class
17
17
 
18
18
  def allocate
19
19
  %x{
20
- var obj = new this;
20
+ var obj = [];
21
21
  obj._id = unique_id++;
22
22
  return obj;
23
23
  }
@@ -25,9 +25,11 @@ class Class
25
25
 
26
26
  def new(*args, &block)
27
27
  %x{
28
- var obj = this.$allocate();
29
- obj._p = block;
30
- obj.$initialize.apply(obj, args);
28
+ var obj = new self;
29
+ obj._id = unique_id++;
30
+ obj.$m.initialize._p = block;
31
+
32
+ obj.$m.initialize.apply(null, [obj].concat(args));
31
33
  return obj;
32
34
  }
33
35
  end
@@ -37,15 +39,7 @@ class Class
37
39
 
38
40
  def superclass
39
41
  %x{
40
- var sup = this._super;
41
-
42
- if (!sup) {
43
- return nil;
44
- }
45
-
46
- while (sup && (sup._isIClass)) {
47
- sup = sup._super;
48
- }
42
+ var sup = #{self}.$s;
49
43
 
50
44
  if (!sup) {
51
45
  return nil;
@@ -0,0 +1,89 @@
1
+ class Dir
2
+ def self.getwd
3
+ ""
4
+ end
5
+
6
+ def self.pwd
7
+ ""
8
+ end
9
+
10
+ def self.[](*globs)
11
+ %x{
12
+ var result = [], files = factories;
13
+
14
+ for (var i = 0, ii = globs.length; i < ii; i++) {
15
+ var glob = globs[i];
16
+
17
+ var re = fs_glob_to_regexp(#{ File.expand_path `glob` });
18
+
19
+ for (var file in files) {
20
+ if (re.exec(file)) {
21
+ result.push(file);
22
+ }
23
+ }
24
+ }
25
+
26
+ return result;
27
+ }
28
+ end
29
+
30
+ %x(
31
+ function fs_glob_to_regexp(glob) {
32
+ var parts = glob.split(''),
33
+ length = parts.length,
34
+ result = '';
35
+
36
+ var opt_group_stack = 0;
37
+
38
+ for (var i = 0; i < length; i++) {
39
+ var cur = parts[i];
40
+
41
+ switch (cur) {
42
+ case '*':
43
+ if (parts[i + 1] === '*' && parts[i + 2] === '/') {
44
+ result += '.*';
45
+ i += 2;
46
+ }
47
+ else {
48
+ result += '[^/]*';
49
+ }
50
+ break;
51
+
52
+ case '.':
53
+ result += '\\\\';
54
+ result += cur;
55
+ break;
56
+
57
+ case ',':
58
+ if (opt_group_stack) {
59
+ result += '|';
60
+ }
61
+ else {
62
+ result += ',';
63
+ }
64
+ break;
65
+
66
+ case '{':
67
+ result += '(';
68
+ opt_group_stack++;
69
+ break;
70
+
71
+ case '}':
72
+ if (opt_group_stack) {
73
+ result += ')';
74
+ opt_group_stack--;
75
+ }
76
+ else {
77
+ result += '}'
78
+ }
79
+ break;
80
+
81
+ default:
82
+ result += cur;
83
+ }
84
+ }
85
+
86
+ return new RegExp('^' + result + '$');
87
+ }
88
+ )
89
+ end
@@ -1,13 +1,13 @@
1
1
  module Enumerable
2
2
  def all?(&block)
3
3
  %x{
4
- var result = true, proc;
4
+ var result = true, proc, each = #{self}.$m.each;
5
5
 
6
6
  if (block !== nil) {
7
- proc = function(obj) {
7
+ proc = function(s, obj) {
8
8
  var value;
9
9
 
10
- if ((value = block.call(__context, obj)) === __breaker) {
10
+ if ((value = block(__context, obj)) === __breaker) {
11
11
  return __breaker.$v;
12
12
  }
13
13
 
@@ -20,7 +20,7 @@ module Enumerable
20
20
  }
21
21
  }
22
22
  else {
23
- proc = function(obj) {
23
+ proc = function(s, obj) {
24
24
  if (obj === false || obj === nil) {
25
25
  result = false;
26
26
  __breaker.$v = nil;
@@ -30,8 +30,8 @@ module Enumerable
30
30
  }
31
31
  }
32
32
 
33
- this.$each._p = proc;
34
- this.$each();
33
+ each._p = proc;
34
+ each(#{self});
35
35
 
36
36
  return result;
37
37
  }
@@ -39,13 +39,13 @@ module Enumerable
39
39
 
40
40
  def any?(&block)
41
41
  %x{
42
- var result = false, proc;
42
+ var result = false, proc, each = #{self}.$m.each;
43
43
 
44
44
  if (block !== nil) {
45
- proc = function(obj) {
45
+ proc = function(s, obj) {
46
46
  var value;
47
47
 
48
- if ((value = block.call(__context, obj)) === __breaker) {
48
+ if ((value = block(__context, obj)) === __breaker) {
49
49
  return __breaker.$v;
50
50
  }
51
51
 
@@ -58,7 +58,7 @@ module Enumerable
58
58
  }
59
59
  }
60
60
  else {
61
- proc = function(obj) {
61
+ proc = function(s, obj) {
62
62
  if (obj !== false && obj !== nil) {
63
63
  result = true;
64
64
  __breaker.$v = nil;
@@ -68,8 +68,8 @@ module Enumerable
68
68
  }
69
69
  }
70
70
 
71
- this.$each._p = proc;
72
- this.$each();
71
+ each._p = proc;
72
+ each(#{self});
73
73
 
74
74
  return result;
75
75
  }
@@ -79,20 +79,20 @@ module Enumerable
79
79
  return enum_for :collect unless block_given?
80
80
 
81
81
  %x{
82
- var result = [];
82
+ var result = [], each = #{self}.$m.each;
83
83
 
84
84
  var proc = function() {
85
- var obj = __slice.call(arguments), value;
85
+ var obj = __slice.call(arguments, 1), value;
86
86
 
87
- if ((value = block.apply(__context, obj)) === __breaker) {
87
+ if ((value = block.apply(null, [__context].concat(obj))) === __breaker) {
88
88
  return __breaker.$v;
89
89
  }
90
90
 
91
91
  result.push(value);
92
92
  };
93
93
 
94
- this.$each._p = proc;
95
- this.$each();
94
+ each._p = proc;
95
+ each(#{self});
96
96
 
97
97
  return result;
98
98
  }
@@ -100,21 +100,19 @@ module Enumerable
100
100
 
101
101
  def count(object, &block)
102
102
  %x{
103
- var result = 0;
103
+ var result = 0, each = #{self}.$m.each;
104
104
 
105
- if (block === nil) {
106
- if (object == null) {
107
- block = function() { return true; };
108
- }
109
- else {
110
- block = function(obj) { return #{`obj` == `object`}; };
111
- }
105
+ if (object != null) {
106
+ block = function(s, obj) { return #{ `obj` == `object` }; };
107
+ }
108
+ else if (block === nil) {
109
+ block = function() { return true; };
112
110
  }
113
111
 
114
- var proc = function(obj) {
112
+ var proc = function(s, obj) {
115
113
  var value;
116
114
 
117
- if ((value = block.call(__context, obj)) === __breaker) {
115
+ if ((value = block(__context, obj)) === __breaker) {
118
116
  return __breaker.$v;
119
117
  }
120
118
 
@@ -123,8 +121,8 @@ module Enumerable
123
121
  }
124
122
  }
125
123
 
126
- this.$each._p = proc;
127
- this.$each();
124
+ each._p = proc;
125
+ each(#{self});
128
126
 
129
127
  return result;
130
128
  }
@@ -134,12 +132,12 @@ module Enumerable
134
132
  return enum_for :detect, ifnone unless block_given?
135
133
 
136
134
  %x{
137
- var result = nil;
135
+ var result = nil, each = #{self}.$m.each;
138
136
 
139
- this.$each._p = function(obj) {
137
+ each._p = function(s, obj) {
140
138
  var value;
141
139
 
142
- if ((value = block.call(__context, obj)) === __breaker) {
140
+ if ((value = block(__context, obj)) === __breaker) {
143
141
  return __breaker.$v;
144
142
  }
145
143
 
@@ -151,14 +149,14 @@ module Enumerable
151
149
  }
152
150
  };
153
151
 
154
- this.$each();
152
+ each(#{self});
155
153
 
156
154
  if (result !== nil) {
157
155
  return result;
158
156
  }
159
157
 
160
158
  if (typeof(ifnone) === 'function') {
161
- return ifnone.$call();
159
+ return #{ ifnone.call };
162
160
  }
163
161
 
164
162
  return ifnone == null ? nil : ifnone;
@@ -168,9 +166,10 @@ module Enumerable
168
166
  def drop(number)
169
167
  %x{
170
168
  var result = [],
171
- current = 0;
169
+ current = 0,
170
+ each = #{self}.$m.each;
172
171
 
173
- this.$each._p = function(obj) {
172
+ each._p = function(s, obj) {
174
173
  if (number < current) {
175
174
  result.push(e);
176
175
  }
@@ -178,7 +177,7 @@ module Enumerable
178
177
  current++;
179
178
  };
180
179
 
181
- this.$each();
180
+ each(#{self});
182
181
 
183
182
  return result;
184
183
  }
@@ -188,24 +187,25 @@ module Enumerable
188
187
  return enum_for :drop_while unless block_given?
189
188
 
190
189
  %x{
191
- var result = [];
190
+ var result = [], each = #{self}.$m.each;
192
191
 
193
- this.$each._p = function(obj) {
192
+ each._p = function(s, obj) {
194
193
  var value;
195
194
 
196
- if ((value = block.call(__context, obj)) === __breaker) {
195
+ if ((value = block(__context, obj)) === __breaker) {
197
196
  return __breaker;
198
197
  }
199
198
 
200
- if (value !== false && value !== nil) {
199
+ if (value === false || value === nil) {
201
200
  result.push(obj);
201
+ return value;
202
202
  }
203
- else {
204
- return __breaker;
205
- }
203
+
204
+
205
+ return __breaker;
206
206
  };
207
207
 
208
- this.$each();
208
+ each(#{self});
209
209
 
210
210
  return result;
211
211
  }
@@ -215,19 +215,19 @@ module Enumerable
215
215
  return enum_for :each_with_index unless block_given?
216
216
 
217
217
  %x{
218
- var index = 0;
218
+ var index = 0, each = #{self}.$m.each;
219
219
 
220
- this.$each._p = function(obj) {
220
+ each._p = function(s, obj) {
221
221
  var value;
222
222
 
223
- if ((value = block.call(__context, obj, index)) === __breaker) {
223
+ if ((value = block(__context, obj, index)) === __breaker) {
224
224
  return __breaker.$v;
225
225
  }
226
226
 
227
227
  index++;
228
228
  };
229
229
 
230
- this.$each();
230
+ each(#{self});
231
231
 
232
232
  return nil;
233
233
  }
@@ -237,15 +237,17 @@ module Enumerable
237
237
  return enum_for :each_with_object unless block_given?
238
238
 
239
239
  %x{
240
- this.$each._p = function(obj) {
240
+ var each = #{self}.$m.each;
241
+
242
+ each._p = function(s, obj) {
241
243
  var value;
242
244
 
243
- if ((value = block.call(__context, obj, object)) === __breaker) {
245
+ if ((value = block(__context, obj, object)) === __breaker) {
244
246
  return __breaker.$v;
245
247
  }
246
248
  };
247
249
 
248
- this.$each();
250
+ each(#{self});
249
251
 
250
252
  return object;
251
253
  }
@@ -253,13 +255,13 @@ module Enumerable
253
255
 
254
256
  def entries
255
257
  %x{
256
- var result = [];
258
+ var result = [], each = #{self}.$m.each;
257
259
 
258
- this.$each._p = function(obj) {
260
+ each._p = function(m, obj) {
259
261
  result.push(obj);
260
262
  };
261
263
 
262
- this.$each();
264
+ each(#{self});
263
265
 
264
266
  return result;
265
267
  }
@@ -271,25 +273,21 @@ module Enumerable
271
273
  return enum_for :find_all unless block_given?
272
274
 
273
275
  %x{
274
- var result = [];
276
+ var result = [], each = #{self}.$m.each;
275
277
 
276
- this.$each._p = function(obj) {
278
+ each._p = function(s, obj) {
277
279
  var value;
278
280
 
279
- if ((value = block.call(__context, obj)) === __breaker) {
281
+ if ((value = block(__context, obj)) === __breaker) {
280
282
  return __breaker.$v;
281
283
  }
282
284
 
283
285
  if (value !== false && value !== nil) {
284
- //result = obj;
285
- //__breaker.$v = nil;
286
-
287
- //return __breaker;
288
286
  result.push(obj);
289
287
  }
290
288
  };
291
289
 
292
- this.$each();
290
+ each(#{self});
293
291
 
294
292
  return result;
295
293
  }
@@ -297,11 +295,11 @@ module Enumerable
297
295
 
298
296
  def find_index(object, &block)
299
297
  %x{
300
- var proc, result = nil, index = 0;
298
+ var proc, result = nil, index = 0, each = #{self}.$m.each;
301
299
 
302
300
  if (object != null) {
303
- proc = function (obj) {
304
- if (obj.$eq$(object)) {
301
+ proc = function (s, obj) {
302
+ if (#{ `obj` == `object` }) {
305
303
  result = index;
306
304
  return __breaker;
307
305
  }
@@ -309,12 +307,12 @@ module Enumerable
309
307
  };
310
308
  }
311
309
  else if (block === nil) {
312
- return this.$enum_for("find_index");
310
+ return #{ enum_for 'find_index' };
313
311
  } else {
314
- proc = function(obj) {
312
+ proc = function(s, obj) {
315
313
  var value;
316
314
 
317
- if ((value = block.call(__context, obj)) === __breaker) {
315
+ if ((value = block(__context, obj)) === __breaker) {
318
316
  return __breaker.$v;
319
317
  }
320
318
 
@@ -328,9 +326,8 @@ module Enumerable
328
326
  };
329
327
  }
330
328
 
331
- this.$each._p = proc;
332
-
333
- this.$each();
329
+ #{self}.$m.each._p = proc;
330
+ #{self}.$m.each(#{self});
334
331
 
335
332
  return result;
336
333
  }
@@ -340,15 +337,16 @@ module Enumerable
340
337
  %x{
341
338
  var result = [],
342
339
  current = 0,
343
- proc;
340
+ proc,
341
+ each = #{self}.$m.each;
344
342
 
345
343
  if (number == null) {
346
344
  result = nil;
347
- proc = function(obj) {
345
+ proc = function(s, obj) {
348
346
  result = obj; return __breaker;
349
347
  };
350
348
  } else {
351
- proc = function(obj) {
349
+ proc = function(s, obj) {
352
350
  if (number <= current) {
353
351
  return __breaker;
354
352
  }
@@ -359,9 +357,8 @@ module Enumerable
359
357
  };
360
358
  }
361
359
 
362
- this.$each._p = proc;
363
-
364
- this.$each();
360
+ each._p = proc;
361
+ each(#{self});
365
362
 
366
363
  return result;
367
364
  }
@@ -369,29 +366,29 @@ module Enumerable
369
366
 
370
367
  def grep(pattern, &block)
371
368
  %x{
372
- var result = [];
369
+ var result = [], each = #{self}.$m.each;
373
370
 
374
- this.$each._p = (block !== nil
375
- ? function(obj) {
376
- var value = pattern.$eqq$(obj);
371
+ each._p = (block !== nil
372
+ ? function(s, obj) {
373
+ var value = #{pattern === `obj`};
377
374
 
378
375
  if (value !== false && value !== nil) {
379
- if ((value = block.call(__context, obj)) === __breaker) {
376
+ if ((value = block(__context, obj)) === __breaker) {
380
377
  return __breaker.$v;
381
378
  }
382
379
 
383
380
  result.push(value);
384
381
  }
385
382
  }
386
- : function(obj) {
387
- var value = pattern.$eqq$(obj);
383
+ : function(s, obj) {
384
+ var value = #{pattern === `obj`};
388
385
 
389
386
  if (value !== false && value !== nil) {
390
387
  result.push(obj);
391
388
  }
392
389
  });
393
390
 
394
- this.$each();
391
+ each(#{self});
395
392
 
396
393
  return result;
397
394
  }