ruby2js 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/demo/ruby2js.rb +5 -3
- data/lib/ruby2js/converter/super.rb +4 -1
- data/lib/ruby2js/filter/functions.rb +15 -15
- data/lib/ruby2js/version.rb +1 -1
- data/lib/ruby2js.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7670b3fccc40291f247fbb15e25ad70703a10bb7e799bede8a1b08f882e686f8
|
4
|
+
data.tar.gz: dd00e4e5897573cf381b2c2e1a8eb26da809f16082049662b457ede53d3ab6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
61
|
-
|
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
|
@@ -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
|
-
|
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
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
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
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
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
|
324
|
+
process s(:send, target, :toLowerCase)
|
325
325
|
|
326
326
|
elsif method == :upcase and args.length == 0
|
327
|
-
process
|
327
|
+
process s(:send, target, :toUpperCase)
|
328
328
|
|
329
329
|
elsif method == :strip and args.length == 0
|
330
330
|
process s(:send, target, :trim)
|
data/lib/ruby2js/version.rb
CHANGED
data/lib/ruby2js.rb
CHANGED
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.
|
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:
|
12
|
+
date: 2024-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parser
|