ruby2js 3.3.0 → 3.3.5

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: b2ad87139fac25c7b097f2ee32c59b141936bb8424cf93a4a20c2d9393495528
4
- data.tar.gz: 4de6a0b69d4d496faae496b37c21c66caee4f3793b1241baf134b5a05c85c7f9
3
+ metadata.gz: 290afa338befd02c8b83d54b13032a5e2d59c8a9cb96f2c413042d069c2614f8
4
+ data.tar.gz: ed8506fa6b7dfbdcec3c59f6496a4cae822b18e597fb7030a10ae403d8b7c942
5
5
  SHA512:
6
- metadata.gz: 8e359e299801b09bc428a93fdf95d4ac1128fbb19266636034fad929d3fa3759f504e59bbd70eb923733b0656770309f845e23aeb0e4e24424ab0161f6fe528a
7
- data.tar.gz: '0874df3f8606f65be7cbae4114c2d384938f7827391020ee0f85d0d99340e4e905010dbe7216ebab17f0adf72fa7793525c95a6e083273abc08cae3dd076d849'
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
- [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
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 = 0
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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(">= 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
- if s.respond_to? :specification_version then
22
- s.specification_version = 4
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.0
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-09-30 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
@@ -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: 1.9.3
157
+ version: '2.0'
144
158
  required_rubygems_version: !ruby/object:Gem::Requirement
145
159
  requirements:
146
160
  - - ">="