ruby2js 5.1.1 → 5.1.2

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: b6436ac11f25e564ac1a5c8efdc17cd8c2f20e6d024899abdaa9badcb35c7c2b
4
- data.tar.gz: c9f18781880390e3fd6db9a699a9de8c92c0ca34d853d416ff0a1daf3fa5b64f
3
+ metadata.gz: 7670b3fccc40291f247fbb15e25ad70703a10bb7e799bede8a1b08f882e686f8
4
+ data.tar.gz: dd00e4e5897573cf381b2c2e1a8eb26da809f16082049662b457ede53d3ab6d1
5
5
  SHA512:
6
- metadata.gz: c6531b7bdae9313e665ed2801e78db70aa8fc22fd667aaed1d2ec9ce17824f2a812efa123c0341e518a40303c264c929d084f2160e98f9c6132a47684a3cf4c7
7
- data.tar.gz: f0a805108a89a46132625ab5541a490e8e08c1fdd62483009a415aa2bff71d11c4427f35d8f9bc6b6e24f4512ab8bc50108ba18d3abb3370e76216f2c51bbcca
6
+ metadata.gz: 85ef0be2e74d3b168a43eaf0daac181430c357562d08d4169db178a266f5a86ba6862a143bd7fe006a3299d6a279bf97a20a0966635624b282f37b5506261cac
7
+ data.tar.gz: 57ea89ccfa8520c33555b11e61656552f720ce3569061d76e1ab2eb13b71df556add113fa18e02dea081822cc9f726b767816aeea7dddab7a6fa5562e30b2e14
@@ -36,7 +36,10 @@ module Ruby2JS
36
36
  end
37
37
 
38
38
  put '('
39
- parse s(:args, *args)
39
+ cleaned_args = args.map do |arg| # FIX: #212
40
+ arg.type == :optarg ? s(:arg, arg.children[0]) : arg
41
+ end
42
+ parse s(:args, *cleaned_args)
40
43
  put ')'
41
44
  else
42
45
  parse @class_parent
@@ -266,25 +266,25 @@ module Ruby2JS
266
266
 
267
267
  elsif [:start_with?, :end_with?].include? method and args.length == 1
268
268
  if es2015
269
- if method == :start_with?
269
+ if method == :start_with?
270
270
  process S(:send, target, :startsWith, *args)
271
271
  else
272
272
  process S(:send, target, :endsWith, *args)
273
273
  end
274
274
  else
275
- if args.first.type == :str
276
- length = S(:int, args.first.children.first.length)
277
- else
278
- length = S(:attr, *args, :length)
279
- end
275
+ if args.first.type == :str
276
+ length = S(:int, args.first.children.first.length)
277
+ else
278
+ length = S(:attr, *args, :length)
279
+ end
280
280
 
281
- if method == :start_with?
282
- process S(:send, S(:send, target, :substring, s(:int, 0),
283
- length), :==, *args)
284
- else
285
- process S(:send, S(:send, target, :slice,
286
- S(:send, length, :-@)), :==, *args)
287
- end
281
+ if method == :start_with?
282
+ process S(:send, S(:send, target, :substring, s(:int, 0),
283
+ length), :==, *args)
284
+ else
285
+ process S(:send, S(:send, target, :slice,
286
+ S(:send, length, :-@)), :==, *args)
287
+ end
288
288
  end
289
289
 
290
290
  elsif method == :clear and args.length == 0 and node.is_method?
@@ -321,10 +321,10 @@ module Ruby2JS
321
321
  process S(:send, target, :forEach, *args)
322
322
 
323
323
  elsif method == :downcase and args.length == 0
324
- process S(:send, target, :toLowerCase)
324
+ process s(:send, target, :toLowerCase)
325
325
 
326
326
  elsif method == :upcase and args.length == 0
327
- process S(:send, target, :toUpperCase)
327
+ process s(:send, target, :toUpperCase)
328
328
 
329
329
  elsif method == :strip and args.length == 0
330
330
  process s(:send, target, :trim)
@@ -2,7 +2,7 @@ module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 5
4
4
  MINOR = 1
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/ruby2js.rb CHANGED
@@ -60,6 +60,7 @@ module Ruby2JS
60
60
  Parser::AST::Node.new type, args
61
61
  end
62
62
 
63
+ # update existing node
63
64
  def S(type, *args)
64
65
  @ast.updated(type, args)
65
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2js
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-05 00:00:00.000000000 Z
12
+ date: 2024-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parser