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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01206317a8156704b69b59656c26eb7bc91a832faf85d152fc514b4b9fbee38a
4
- data.tar.gz: f57331bc9505cd15099c4b4ffb53475e0a04f288fc4949fd4c91961959ee149f
3
+ metadata.gz: 888fb767c9a587a64db5b2739009627f3db16f1a5f9d9d032cd98d3d9fdc2167
4
+ data.tar.gz: e32434b17986c142d784156bc6fbf4e7429bd9a0c333bd3bc8aa86036cc57276
5
5
  SHA512:
6
- metadata.gz: 5d67b911c57d6a76ce93efb80a98e902e0d089125414d0d8f5a25834241f1a336141ef149a8bda48cfd5996e8de032f5b06920cb95c16be10cdf156189714651
7
- data.tar.gz: e57e5a000416f686d386a7033a082d394d55b42bc0f468bf2b14b74573bbff1157fc5ab1b1de6f8d790e232e8ab71f21974dd81dedb5bb49fab6897b2aa56265
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
- [camelCase_spec](https://github.com/rubys/ruby2js/blob/master/spec/camelCase_spec.rb)
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, inheritance)),
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 \
@@ -2,7 +2,7 @@ module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
- TINY = 1
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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(">= 1.9.3".freeze)
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.1
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-01 00:00:00.000000000 Z
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: 1.9.3
157
+ version: '2.0'
158
158
  required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  requirements:
160
160
  - - ">="