opal 1.4.0.alpha1 → 1.4.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -7
- data/UNRELEASED.md +1 -64
- data/docs/releasing.md +2 -3
- data/lib/opal/nodes/if.rb +4 -0
- data/lib/opal/nodes/x_string.rb +27 -28
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/module.rb +5 -18
- data/spec/opal/core/language/xstring_spec.rb +13 -0
- metadata +9 -9
- data/spec/opal/core/language/super_spec.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec2d9bb3f02059898f9a494c018fbcb4f451c4c5130b3e9ff455bf3ce1561fc9
|
4
|
+
data.tar.gz: a69e0554d43a0ef0ad6e7d439beb313536227615698487b8283321e879cf150d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a96aade4e8183b8f00136eb4c5e64ea1f6b12b03aec98096476de4dd414b03b9ecfb90658a29bef403b366e36db43283b6e175cac5dcc3796453535f9ad7bd0
|
7
|
+
data.tar.gz: 8ea23169b1492a34b5bf98750259f9d9da636bb5070b50fad624a56a2eea65f4c5975a6385af3dfbdfad2a41985f5d32ba3aa583feea39b79b59ccc3cac20c43
|
data/CHANGELOG.md
CHANGED
@@ -15,6 +15,83 @@ Changes are grouped as follows:
|
|
15
15
|
|
16
16
|
|
17
17
|
|
18
|
+
## [1.4.0](https://github.com/opal/opal/compare/v1.3.2...v1.4.0) - 2021-12-24
|
19
|
+
|
20
|
+
|
21
|
+
### Added
|
22
|
+
|
23
|
+
- Implement `chomp:` option for `String#each_line` and `#lines` ([#2355](https://github.com/opal/opal/pull/2355))
|
24
|
+
- Ruby 3.1 support and some older Ruby features we missed ([#2347](https://github.com/opal/opal/pull/2347))
|
25
|
+
- Use parser in 3.1 mode to support new language-level features like hashes/kwargs value omission, the pin operator for pattern matching
|
26
|
+
- `Array#intersect?`
|
27
|
+
- `String#strip` and `String#lstrip` to also remove NUL bytes
|
28
|
+
- `Integer.try_convert`
|
29
|
+
- `public`, `private`, `protected`, `module_function` now return their arguments
|
30
|
+
- `Class#descendants`, `Class#subclasses`
|
31
|
+
- (<=1.8) `Kernel#local_variables`
|
32
|
+
- (<=2.3) Set local variables for regexp named captures (`/(?<b>a)/ =~ 'a'` => `b = 'a'`)
|
33
|
+
- Remove deprecated `NIL`, `TRUE`, `FALSE` constants
|
34
|
+
- `String#unpack` and `String#unpack1` to support an `offset:` kwarg
|
35
|
+
- `MatchData#match`, `MatchData#match_length`
|
36
|
+
- Enumerable modernization
|
37
|
+
- `Enumerable#tally` to support an optional hash accumulator
|
38
|
+
- `Enumerable#each_{cons,slice}` to return self
|
39
|
+
- `Enumerable#compact`
|
40
|
+
- `Refinement` becomes its own class now
|
41
|
+
- `Struct#keyword_init?`
|
42
|
+
- (pre-3.1) Large Enumerator rework
|
43
|
+
- Introduce `Enumerator::ArithmeticSequence`
|
44
|
+
- Introduce `Enumerator::Chain`
|
45
|
+
- Introduce `Enumerator#+` to create `Enumerator::Chain`s
|
46
|
+
- `Enumerator#{rewind,peek,peek_values,next,next_values}`
|
47
|
+
- Improve corelib support for beginless/endless ranges and `ArithmeticSequences`
|
48
|
+
- `String#[]`, `Array#[]`, `Array#[]=`, `Array#fill`, `Array#values_at`
|
49
|
+
- `Range#step` and `Numeric#step` return an `ArithmeticSequence` when `Numeric` values are in play
|
50
|
+
- Introduce `Range#%`
|
51
|
+
- `Enumerator::Yielder#to_proc`
|
52
|
+
- Fix #2367
|
53
|
+
- (2.7) `UnboundMethod#bind_call`
|
54
|
+
- (Opal) `{Kernel,BasicObject}#{inspect,p,pp,method_missing}` may work with JS native values now, also they now correctly report cycles
|
55
|
+
- `Enumerable#sum` uses Kahan's summation algorithm to reduce error with floating point values
|
56
|
+
- `File.dirname` supports a new `level` argument
|
57
|
+
- Vendor in `optparse` and `shellwords` ([#2326](https://github.com/opal/opal/pull/2326))
|
58
|
+
- Preliminary support for compiling the whole `bin/opal` with Opal ([#2326](https://github.com/opal/opal/pull/2326))
|
59
|
+
|
60
|
+
### Fixed
|
61
|
+
|
62
|
+
- Fix coertion for `Array#drop` ([#2371](https://github.com/opal/opal/pull/2371))
|
63
|
+
- Fix coertion for `File.absolute_path` ([#2372](https://github.com/opal/opal/pull/2372))
|
64
|
+
- Fix some `IO#puts` edge cases (no args, empty array, nested array, …) ([#2372](https://github.com/opal/opal/pull/2372))
|
65
|
+
- Preserve UNC path prefix on File.join ([#2366](https://github.com/opal/opal/pull/2366))
|
66
|
+
- Methods on `Kernel`, `BasicObject`, `Boolean` will never return boxed values anymore ([#2293](https://github.com/opal/opal/pull/2293))
|
67
|
+
- `false.tap{}` will now correctly return a JS value of `false`, not `Object(false)`
|
68
|
+
- opal-parser doesn't break on `<<~END` strings anymore ([#2364](https://github.com/opal/opal/pull/2364))
|
69
|
+
- Fix error reporting at the early stage of loading ([#2326](https://github.com/opal/opal/pull/2326))
|
70
|
+
|
71
|
+
### Changed
|
72
|
+
|
73
|
+
- Various outputted code size optimizations - 19% improvement for minified unmangled AsciiDoctor bundle - see: https://opalrb.com/blog/2021/11/24/optimizing-opal-output-for-size/ ([#2356](https://github.com/opal/opal/pull/2356))
|
74
|
+
- Second round of code size optimizations - 3% improvement for AsciiDoctor bundle on top of the first round - 23% total - see: https://github.com/opal/opal/pull/2365/commits ([#2365](https://github.com/opal/opal/pull/2365))
|
75
|
+
- The calls to `==`, `!=` and `===` changed their semantics slightly: it's impossible to monkey patch those calls for `String` and `Number`, but on other classes they can now return `nil` and it will be handled correctly
|
76
|
+
- The calls to `!` changed their semantics slightly: it's impossible to monkey patch this call for `Boolean` or `NilClass`.
|
77
|
+
- Refactored the structure of the internal `stdlib/nodejs` folder ([#2374](https://github.com/opal/opal/pull/2374))
|
78
|
+
- Added `nodejs/base` with just I/O, exit, and ARGV management
|
79
|
+
- Moved `Process::Status` to corelib
|
80
|
+
- Fixed requires to be more robust
|
81
|
+
|
82
|
+
### Removed
|
83
|
+
|
84
|
+
- Removed `nodejs/irb` from stdlib as it's been broken for some time ([#2374](https://github.com/opal/opal/pull/2374))
|
85
|
+
- Removed `Kernel#node_require` from `nodejs/kernel` as it's been deprecated for a long time ([#2374](https://github.com/opal/opal/pull/2374))
|
86
|
+
|
87
|
+
<!--
|
88
|
+
### Deprecated
|
89
|
+
### Internal
|
90
|
+
-->
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
18
95
|
## [1.3.2](https://github.com/opal/opal/compare/v1.3.1...v1.3.2) - 2021-11-10
|
19
96
|
|
20
97
|
|
@@ -26,13 +103,6 @@ Changes are grouped as follows:
|
|
26
103
|
- Do not modify `$~` when calling `String#scan` from internal methods ([#2353](https://github.com/opal/opal/pull/2353))
|
27
104
|
- Stop interpreting falsey values as a missing constant in `Module#const_get` ([#2354](https://github.com/opal/opal/pull/2354))
|
28
105
|
|
29
|
-
<!--
|
30
|
-
### Changed
|
31
|
-
### Deprecated
|
32
|
-
### Removed
|
33
|
-
### Internal
|
34
|
-
-->
|
35
|
-
|
36
106
|
|
37
107
|
|
38
108
|
|
data/UNRELEASED.md
CHANGED
@@ -1,71 +1,8 @@
|
|
1
|
+
<!--
|
1
2
|
### Added
|
2
|
-
|
3
|
-
- Implement `chomp:` option for `String#each_line` and `#lines` (#2355)
|
4
|
-
- Ruby 3.1 support and some older Ruby features we missed (#2347)
|
5
|
-
- Use parser in 3.1 mode to support new language-level features like hashes/kwargs value omission, the pin operator for pattern matching
|
6
|
-
- `Array#intersect?`
|
7
|
-
- `String#strip` and `String#lstrip` to also remove NUL bytes
|
8
|
-
- `Integer.try_convert`
|
9
|
-
- `public`, `private`, `protected`, `module_function` now return their arguments
|
10
|
-
- `Class#descendants`, `Class#subclasses`
|
11
|
-
- (<=1.8) `Kernel#local_variables`
|
12
|
-
- (<=2.3) Set local variables for regexp named captures (`/(?<b>a)/ =~ 'a'` => `b = 'a'`)
|
13
|
-
- Remove deprecated `NIL`, `TRUE`, `FALSE` constants
|
14
|
-
- `String#unpack` and `String#unpack1` to support an `offset:` kwarg
|
15
|
-
- `MatchData#match`, `MatchData#match_length`
|
16
|
-
- Enumerable modernization
|
17
|
-
- `Enumerable#tally` to support an optional hash accumulator
|
18
|
-
- `Enumerable#each_{cons,slice}` to return self
|
19
|
-
- `Enumerable#compact`
|
20
|
-
- `Refinement` becomes its own class now
|
21
|
-
- `Struct#keyword_init?`
|
22
|
-
- (pre-3.1) Large Enumerator rework
|
23
|
-
- Introduce `Enumerator::ArithmeticSequence`
|
24
|
-
- Introduce `Enumerator::Chain`
|
25
|
-
- Introduce `Enumerator#+` to create `Enumerator::Chain`s
|
26
|
-
- `Enumerator#{rewind,peek,peek_values,next,next_values}`
|
27
|
-
- Improve corelib support for beginless/endless ranges and `ArithmeticSequences`
|
28
|
-
- `String#[]`, `Array#[]`, `Array#[]=`, `Array#fill`, `Array#values_at`
|
29
|
-
- `Range#step` and `Numeric#step` return an `ArithmeticSequence` when `Numeric` values are in play
|
30
|
-
- Introduce `Range#%`
|
31
|
-
- `Enumerator::Yielder#to_proc`
|
32
|
-
- Fix #2367
|
33
|
-
- (2.7) `UnboundMethod#bind_call`
|
34
|
-
- (Opal) `{Kernel,BasicObject}#{inspect,p,pp,method_missing}` may work with JS native values now, also they now correctly report cycles
|
35
|
-
- `Enumerable#sum` uses Kahan's summation algorithm to reduce error with floating point values
|
36
|
-
- `File.dirname` supports a new `level` argument
|
37
|
-
- Vendor in `optparse` and `shellwords` (#2326)
|
38
|
-
- Preliminary support for compiling the whole `bin/opal` with Opal (#2326)
|
39
|
-
|
40
3
|
### Fixed
|
41
|
-
|
42
|
-
- Fix defining multiple methods with the same block (#2345)
|
43
|
-
- Fix coertion for `Array#drop` (#2371)
|
44
|
-
- Fix coertion for `File.absolute_path` (#2372)
|
45
|
-
- Fix some `IO#puts` edge cases (no args, empty array, nested array, …) (#2372)
|
46
|
-
- Preserve UNC path prefix on File.join (#2366)
|
47
|
-
- Methods on `Kernel`, `BasicObject`, `Boolean` will never return boxed values anymore (#2293)
|
48
|
-
- `false.tap{}` will now correctly return a JS value of `false`, not `Object(false)`
|
49
|
-
- opal-parser doesn't break on `<<~END` strings anymore (#2364)
|
50
|
-
- Fix error reporting at the early stage of loading (#2326)
|
51
|
-
|
52
4
|
### Changed
|
53
|
-
|
54
|
-
- Various outputted code size optimizations - 19% improvement for minified unmangled AsciiDoctor bundle - see: https://opalrb.com/blog/2021/11/24/optimizing-opal-output-for-size/ (#2356)
|
55
|
-
- Second round of code size optimizations - 3% improvement for AsciiDoctor bundle on top of the first round - 23% total - see: https://github.com/opal/opal/pull/2365/commits (#2365)
|
56
|
-
- The calls to `==`, `!=` and `===` changed their semantics slightly: it's impossible to monkey patch those calls for `String` and `Number`, but on other classes they can now return `nil` and it will be handled correctly
|
57
|
-
- The calls to `!` changed their semantics slightly: it's impossible to monkey patch this call for `Boolean` or `NilClass`.
|
58
|
-
- Refactored the structure of the internal `stdlib/nodejs` folder (#2374)
|
59
|
-
- Added `nodejs/base` with just I/O, exit, and ARGV management
|
60
|
-
- Moved `Process::Status` to corelib
|
61
|
-
- Fixed requires to be more robust
|
62
|
-
|
63
5
|
### Removed
|
64
|
-
|
65
|
-
- Removed `nodejs/irb` from stdlib as it's been broken for some time (#2374)
|
66
|
-
- Removed `Kernel#node_require` from `nodejs/kernel` as it's been deprecated for a long time (#2374)
|
67
|
-
|
68
|
-
<!--
|
69
6
|
### Deprecated
|
70
7
|
### Internal
|
71
8
|
-->
|
data/docs/releasing.md
CHANGED
@@ -11,15 +11,14 @@ _This guide is a work-in-progress._
|
|
11
11
|
|
12
12
|
- Ensure all the unreleased changes are documented in UNRELEASED.md
|
13
13
|
- Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
|
14
|
+
- Empty UNRELEASED.md
|
14
15
|
|
15
16
|
## The commit
|
16
17
|
|
17
18
|
- Commit the updated changelog along with the version bump using this commit message:
|
18
19
|
"Release v1.2.3"
|
19
20
|
- Push the commit and run `bin/rake release` to release the new version to Rubygems
|
20
|
-
- Go to GitHub releases and create a new release from the latest tag pasting the contents
|
21
|
-
- Empty UNRELEASED.md and run `bin/rake changelog`
|
22
|
-
- Push the updated changelog
|
21
|
+
- Go to GitHub releases and create a new release from the latest tag pasting the contents from CHANGELOG.md
|
23
22
|
|
24
23
|
## Opal docs
|
25
24
|
|
data/lib/opal/nodes/if.rb
CHANGED
@@ -147,6 +147,10 @@ module Opal
|
|
147
147
|
case body.type
|
148
148
|
when :return, :js_return, :break, :next, :redo, :retry
|
149
149
|
false
|
150
|
+
when :xstr
|
151
|
+
XStringNode.single_line?(
|
152
|
+
XStringNode.strip_empty_children(body.children)
|
153
|
+
)
|
150
154
|
else
|
151
155
|
body.children.all? { |i| simple?(i) }
|
152
156
|
end
|
data/lib/opal/nodes/x_string.rb
CHANGED
@@ -8,9 +8,9 @@ module Opal
|
|
8
8
|
def compile
|
9
9
|
@should_add_semicolon = false
|
10
10
|
unpacked_children = unpack_return(children)
|
11
|
-
stripped_children = strip_empty_children(unpacked_children)
|
11
|
+
stripped_children = XStringNode.strip_empty_children(unpacked_children)
|
12
12
|
|
13
|
-
if single_line?(stripped_children)
|
13
|
+
if XStringNode.single_line?(stripped_children)
|
14
14
|
# If it's a single line we'll try to:
|
15
15
|
#
|
16
16
|
# - strip empty lines
|
@@ -30,6 +30,31 @@ module Opal
|
|
30
30
|
push ';' if @should_add_semicolon
|
31
31
|
end
|
32
32
|
|
33
|
+
# Check if there's only one child or if they're all part of
|
34
|
+
# the same line (e.g. because of interpolations)
|
35
|
+
def self.single_line?(children)
|
36
|
+
(children.size == 1) || children.none? do |c|
|
37
|
+
c.type == :str && c.loc.expression.source.end_with?("\n")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Will remove empty :str lines coming from cosmetic newlines in x-strings
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# # this will generate two additional empty
|
45
|
+
# # children before and after `foo()`
|
46
|
+
# %x{
|
47
|
+
# foo()
|
48
|
+
# }
|
49
|
+
def self.strip_empty_children(children)
|
50
|
+
children = children.dup
|
51
|
+
empty_line = ->(child) { child.nil? || (child.type == :str && child.loc.expression.source.rstrip.empty?) }
|
52
|
+
|
53
|
+
children.shift while children.any? && empty_line[children.first]
|
54
|
+
children.pop while children.any? && empty_line[children.last]
|
55
|
+
|
56
|
+
children
|
57
|
+
end
|
33
58
|
|
34
59
|
private
|
35
60
|
|
@@ -97,14 +122,6 @@ module Opal
|
|
97
122
|
last_value
|
98
123
|
end
|
99
124
|
|
100
|
-
# Check if there's only one child or if they're all part of
|
101
|
-
# the same line (e.g. because of interpolations)
|
102
|
-
def single_line?(children)
|
103
|
-
(children.size == 1) || children.none? do |c|
|
104
|
-
c.type == :str && c.loc.expression.source.end_with?("\n")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
125
|
# A case for manually created :js_return statement in Compiler#returns
|
109
126
|
# Since we need to take original source of :str we have to use raw source
|
110
127
|
# so we need to combine "return" with "raw_source"
|
@@ -119,24 +136,6 @@ module Opal
|
|
119
136
|
|
120
137
|
children
|
121
138
|
end
|
122
|
-
|
123
|
-
# Will remove empty :str lines coming from cosmetic newlines in x-strings
|
124
|
-
#
|
125
|
-
# @example
|
126
|
-
# # this will generate two additional empty
|
127
|
-
# # children before and after `foo()`
|
128
|
-
# %x{
|
129
|
-
# foo()
|
130
|
-
# }
|
131
|
-
def strip_empty_children(children)
|
132
|
-
children = children.dup
|
133
|
-
empty_line = ->(child) { child.nil? || (child.type == :str && child.loc.expression.source.rstrip.empty?) }
|
134
|
-
|
135
|
-
children.shift while children.any? && empty_line[children.first]
|
136
|
-
children.pop while children.any? && empty_line[children.last]
|
137
|
-
|
138
|
-
children
|
139
|
-
end
|
140
139
|
end
|
141
140
|
end
|
142
141
|
end
|
data/lib/opal/version.rb
CHANGED
data/opal/corelib/constants.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
::RUBY_PLATFORM = 'opal'
|
2
2
|
::RUBY_ENGINE = 'opal'
|
3
3
|
::RUBY_VERSION = '3.1.0'
|
4
|
-
::RUBY_ENGINE_VERSION = '1.4.0
|
5
|
-
::RUBY_RELEASE_DATE = '2021-12-
|
4
|
+
::RUBY_ENGINE_VERSION = '1.4.0'
|
5
|
+
::RUBY_RELEASE_DATE = '2021-12-24'
|
6
6
|
::RUBY_PATCHLEVEL = 0
|
7
7
|
::RUBY_REVISION = '0'
|
8
8
|
::RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2021 Adam Beynon and the Opal contributors'
|
data/opal/corelib/module.rb
CHANGED
@@ -396,27 +396,14 @@ class ::Module
|
|
396
396
|
end
|
397
397
|
|
398
398
|
%x{
|
399
|
-
// Wrapping and forwarding is required to make super work, as the
|
400
|
-
// same block can be used to define multiple methods.
|
401
|
-
var wrapper = function() {
|
402
|
-
block.$$jsid = name
|
403
|
-
block.$$p = wrapper.$$p
|
404
|
-
block.$$s = null;
|
405
|
-
block.$$def = wrapper;
|
406
|
-
block.$$define_meth = true;
|
407
|
-
|
408
|
-
return block.apply(this, arguments)
|
409
|
-
}
|
410
|
-
|
411
399
|
var id = '$' + name;
|
412
|
-
wrapper.$$jsid = name
|
413
|
-
wrapper.$$s = null;
|
414
|
-
wrapper.$$def = wrapper;
|
415
|
-
wrapper.$$define_meth = true;
|
416
400
|
|
417
|
-
|
401
|
+
block.$$jsid = name;
|
402
|
+
block.$$s = null;
|
403
|
+
block.$$def = block;
|
404
|
+
block.$$define_meth = true;
|
418
405
|
|
419
|
-
return Opal.defn(self, id,
|
406
|
+
return Opal.defn(self, id, block);
|
420
407
|
}
|
421
408
|
end
|
422
409
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-12-
|
13
|
+
date: 2021-12-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ast
|
@@ -860,8 +860,8 @@ files:
|
|
860
860
|
- spec/opal/core/language/numblocks_spec.rb
|
861
861
|
- spec/opal/core/language/pattern_matching_spec.rb
|
862
862
|
- spec/opal/core/language/safe_navigator_spec.rb
|
863
|
-
- spec/opal/core/language/super_spec.rb
|
864
863
|
- spec/opal/core/language/while_spec.rb
|
864
|
+
- spec/opal/core/language/xstring_spec.rb
|
865
865
|
- spec/opal/core/language_spec.rb
|
866
866
|
- spec/opal/core/marshal/dump_spec.rb
|
867
867
|
- spec/opal/core/marshal/load_spec.rb
|
@@ -1151,10 +1151,10 @@ licenses:
|
|
1151
1151
|
metadata:
|
1152
1152
|
homepage_uri: https://opalrb.com/
|
1153
1153
|
bug_tracker_uri: https://github.com/opal/opal/issues
|
1154
|
-
changelog_uri: https://github.com/opal/opal/blob/v1.4.0
|
1155
|
-
readme_uri: https://github.com/opal/opal/blob/v1.4.0
|
1156
|
-
api_documentation_uri: http://opalrb.com/docs/api/v1.4.0
|
1157
|
-
guides_uri: http://opalrb.com/docs/guides/v1.4.0
|
1154
|
+
changelog_uri: https://github.com/opal/opal/blob/v1.4.0/CHANGELOG.md
|
1155
|
+
readme_uri: https://github.com/opal/opal/blob/v1.4.0/README.md
|
1156
|
+
api_documentation_uri: http://opalrb.com/docs/api/v1.4.0/index.html
|
1157
|
+
guides_uri: http://opalrb.com/docs/guides/v1.4.0/index.html
|
1158
1158
|
chat_uri: https://gitter.im/opal/opal
|
1159
1159
|
source_code_uri: https://github.com/opal/opal
|
1160
1160
|
post_install_message:
|
@@ -1168,9 +1168,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1168
1168
|
version: '2.3'
|
1169
1169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1170
1170
|
requirements:
|
1171
|
-
- - "
|
1171
|
+
- - ">="
|
1172
1172
|
- !ruby/object:Gem::Version
|
1173
|
-
version:
|
1173
|
+
version: '0'
|
1174
1174
|
requirements: []
|
1175
1175
|
rubygems_version: 3.2.3
|
1176
1176
|
signing_key:
|
@@ -1,24 +0,0 @@
|
|
1
|
-
describe "a block with super" do
|
2
|
-
it "can be used to define multiple methods" do
|
3
|
-
block = proc {
|
4
|
-
super()
|
5
|
-
}
|
6
|
-
|
7
|
-
c1 = Class.new {
|
8
|
-
def foo; :foo; end
|
9
|
-
def bar; :bar; end
|
10
|
-
def foo_bar; [foo, bar]; end
|
11
|
-
}
|
12
|
-
|
13
|
-
c2 = Class.new(c1) {
|
14
|
-
define_method :foo, block
|
15
|
-
define_method :bar, block
|
16
|
-
define_method :foo_bar, block
|
17
|
-
}
|
18
|
-
|
19
|
-
obj = c2.new
|
20
|
-
obj.foo.should == :foo
|
21
|
-
obj.bar.should == :bar
|
22
|
-
obj.foo_bar.should == [:foo, :bar]
|
23
|
-
end
|
24
|
-
end
|