ruby2js 3.3.1 → 3.3.6
Sign up to get free protection for your applications and to get access to all the features.
- 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 +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 888fb767c9a587a64db5b2739009627f3db16f1a5f9d9d032cd98d3d9fdc2167
|
4
|
+
data.tar.gz: e32434b17986c142d784156bc6fbf4e7429bd9a0c333bd3bc8aa86036cc57276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9229d6f6b976c755fb82af395ff5ea4f111703256408876efc035047ab29c60737c36438d354d137d1877c536bb20bc01f6ac72ea95f5128b41bfa5309894595
|
7
|
+
data.tar.gz: f465097e3b8352bb3e4d74c4b18d2f60ed934956f8384c05866dcc120ca039deb8f09ad61275f98cfa3ba21c92fd05ef821b52282cfb75e027dedd0b461d1b30
|
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 and @class_name
|
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,7 +15,7 @@ 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
21
|
s.add_dependency('parser')
|
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.6
|
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-10-
|
11
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -154,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
154
|
requirements:
|
155
155
|
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
157
|
+
version: '2.0'
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
160
|
- - ">="
|