ruby2js 5.1.0 → 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: 709b38712553ae1a4f14aad4f1a994ba45e54f81ebb1d0a11ec5ae54b55eedcf
4
- data.tar.gz: eba029d424058e50057a226fb65b81d9eebc8956d645947e4dccf212e2b7a5b3
3
+ metadata.gz: 7670b3fccc40291f247fbb15e25ad70703a10bb7e799bede8a1b08f882e686f8
4
+ data.tar.gz: dd00e4e5897573cf381b2c2e1a8eb26da809f16082049662b457ede53d3ab6d1
5
5
  SHA512:
6
- metadata.gz: 246f1a73f71cfac86e0021a509ef5342ccba199a695e9716b61247ccd2cd54e3d5579dda27289dbd01a2bfc2f04a52060357238ce1ccf3cbf64eda5a5174b599
7
- data.tar.gz: ce88cde76f203294a84eaefcf0d61136e30c981fc25682516ed617d2ea884610d21db6b51c7a1fd2fc3552413b4a3222491c8abef6b1dea76f82a53a8ec61646
6
+ metadata.gz: 85ef0be2e74d3b168a43eaf0daac181430c357562d08d4169db178a266f5a86ba6862a143bd7fe006a3299d6a279bf97a20a0966635624b282f37b5506261cac
7
+ data.tar.gz: 57ea89ccfa8520c33555b11e61656552f720ce3569061d76e1ab2eb13b71df556add113fa18e02dea081822cc9f726b767816aeea7dddab7a6fa5562e30b2e14
data/demo/ruby2js.rb CHANGED
@@ -57,9 +57,11 @@ def parse_request(env=ENV)
57
57
 
58
58
  opts.on('--preset', "use sane defaults (modern eslevel & common filters)") {options[:preset] = true}
59
59
 
60
- opts.on('-C', '--config [FILE]', "configuration file to use (default is config/ruby2js.rb)") {|filename|
61
- options[:config_file] = filename
62
- }
60
+ unless env['QUERY_STRING']
61
+ opts.on('-C', '--config [FILE]', "configuration file to use (default is config/ruby2js.rb)") {|filename|
62
+ options[:config_file] = filename
63
+ }
64
+ end
63
65
 
64
66
  opts.on('--autoexports [default]', "add export statements for top level constants") {|option|
65
67
  options[:autoexports] = option ? option.to_sym : true
@@ -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 = 0
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.0
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: 2023-02-20 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