ruby2js 3.3.0 → 3.3.5
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/README.md +1 -1
- data/lib/ruby2js/converter/class.rb +2 -1
- data/lib/ruby2js/converter/hash.rb +19 -0
- data/lib/ruby2js/version.rb +1 -1
- data/ruby2js.gemspec +3 -12
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 290afa338befd02c8b83d54b13032a5e2d59c8a9cb96f2c413042d069c2614f8
|
4
|
+
data.tar.gz: ed8506fa6b7dfbdcec3c59f6496a4cae822b18e597fb7030a10ae403d8b7c942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bfe229a4ac6718d7a79cc41d2ef8b014ac49c4f73366791ffb2b2487b1661dc9a74d91672f866464ba00b83dcbae464b4d1ce0f602aa37fef7c59cd0c2865be
|
7
|
+
data.tar.gz: 9a2a2c7feb84284009900ece1a605922de023fb3173158799fb889cfd0d4ac6ff12d10cfbafa062e8cb133024ee58be204d0abc8fd7ef76d0b8fc20714069346
|
data/README.md
CHANGED
@@ -221,7 +221,7 @@ the script.
|
|
221
221
|
|
222
222
|
* <a id="camelCase" href="https://github.com/rubys/ruby2js/blob/master/lib/ruby2js/filter/camelCase.rb">camelCase</a>
|
223
223
|
converts `underscore_case` to `camelCase`. See
|
224
|
-
[
|
224
|
+
[camelcase_spec](https://github.com/rubys/ruby2js/blob/master/spec/camelcase_spec.rb)
|
225
225
|
for examples.
|
226
226
|
|
227
227
|
* <a id="functions" href="https://github.com/rubys/ruby2js/blob/master/lib/ruby2js/filter/functions.rb">functions</a>
|
@@ -196,7 +196,8 @@ module Ruby2JS
|
|
196
196
|
|
197
197
|
if inheritance
|
198
198
|
body.unshift s(:send, name, :prototype=,
|
199
|
-
s(:send, s(:const, nil, :Object), :create,
|
199
|
+
s(:send, s(:const, nil, :Object), :create,
|
200
|
+
s(:attr, inheritance, :prototype))),
|
200
201
|
s(:send, s(:attr, name, :prototype), :constructor=, name)
|
201
202
|
else
|
202
203
|
body.compact!
|
@@ -95,6 +95,25 @@ module Ruby2JS
|
|
95
95
|
elsif not [:lambda, :proc].include? method
|
96
96
|
anonfn = false
|
97
97
|
end
|
98
|
+
|
99
|
+
# use fat arrow syntax if block contains a reference to 'this'
|
100
|
+
if anonfn
|
101
|
+
walk = proc do |ast|
|
102
|
+
if ast == s(:self)
|
103
|
+
anonfn = false
|
104
|
+
elsif ast.type == :send and ast.children.first == nil
|
105
|
+
method = ast.children.last if ast.children.length == 2
|
106
|
+
if @rbstack.any? {|rb| rb[method]} or method == :this
|
107
|
+
anonfn = false
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
ast.children.each do |child|
|
112
|
+
walk[child] if child.is_a? Parser::AST::Node
|
113
|
+
end
|
114
|
+
end
|
115
|
+
walk[right]
|
116
|
+
end
|
98
117
|
end
|
99
118
|
|
100
119
|
if \
|
data/lib/ruby2js/version.rb
CHANGED
data/ruby2js.gemspec
CHANGED
@@ -15,18 +15,9 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = %w(ruby2js.gemspec README.md) + Dir.glob("{lib}/**/*")
|
16
16
|
s.homepage = "http://github.com/rubys/ruby2js".freeze
|
17
17
|
s.licenses = ["MIT".freeze]
|
18
|
-
s.required_ruby_version = Gem::Requirement.new(">=
|
18
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
|
19
19
|
s.summary = "Minimal yet extensible Ruby to JavaScript conversion.".freeze
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
-
s.add_runtime_dependency(%q<parser>.freeze, [">= 0"])
|
26
|
-
else
|
27
|
-
s.add_dependency(%q<parser>.freeze, [">= 0"])
|
28
|
-
end
|
29
|
-
else
|
30
|
-
s.add_dependency(%q<parser>.freeze, [">= 0"])
|
31
|
-
end
|
21
|
+
s.add_dependency('parser')
|
22
|
+
s.add_dependency('regexp_parser')
|
32
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby2js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: regexp_parser
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: |2
|
28
42
|
The base package maps Ruby syntax to JavaScript semantics.
|
29
43
|
Filters may be provided to add Ruby-specific or framework specific
|
@@ -140,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
154
|
requirements:
|
141
155
|
- - ">="
|
142
156
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
157
|
+
version: '2.0'
|
144
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
159
|
requirements:
|
146
160
|
- - ">="
|