ruby2js 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby2js/converter/if.rb +10 -3
- data/lib/ruby2js/filter/vue.rb +29 -10
- data/lib/ruby2js/serializer.rb +1 -0
- data/lib/ruby2js/version.rb +1 -1
- data/ruby2js.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7aa6e17a303aa03f78a4f25bf01ec99dde4f34
|
4
|
+
data.tar.gz: 583531eec09eecf50076131ff8affccc95839b80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6510a902460ad8073f710bfb2facb174121dcefc3884a9a69a65ee8ec18c43c4848d29c9e8055c0da10ebe3b181ae816e88093202ced6ec72f7ef7a5303e9fe4
|
7
|
+
data.tar.gz: '09cc922113d70a4fb096ef7f73e7e752d18fd0d68ba65be974b55cb8f35db12ecef63fd3f84dcf1307731905c3a92657c07a1ffff0575ff314cde5843b355052'
|
data/lib/ruby2js/converter/if.rb
CHANGED
@@ -30,9 +30,16 @@ module Ruby2JS
|
|
30
30
|
|
31
31
|
while else_block and else_block.type == :if
|
32
32
|
condition, then_block, else_block = else_block.children
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
if then_block
|
34
|
+
put ' else if ('; parse condition; puts ') {'
|
35
|
+
parse then_block, :statement
|
36
|
+
sput '}'
|
37
|
+
else
|
38
|
+
put ' else if ('; parse s(:not, condition); puts ') {'
|
39
|
+
parse else_block, :statement
|
40
|
+
sput '}'
|
41
|
+
else_block = nil
|
42
|
+
end
|
36
43
|
end
|
37
44
|
|
38
45
|
if else_block
|
data/lib/ruby2js/filter/vue.rb
CHANGED
@@ -25,7 +25,8 @@ module Ruby2JS
|
|
25
25
|
@vue_self = nil
|
26
26
|
@vue_apply = nil
|
27
27
|
@vue_inventory = Hash.new {|h, k| h[k] = []}
|
28
|
-
@
|
28
|
+
@vue_methods = []
|
29
|
+
@vue_props = []
|
29
30
|
super
|
30
31
|
end
|
31
32
|
|
@@ -73,15 +74,22 @@ module Ruby2JS
|
|
73
74
|
end
|
74
75
|
|
75
76
|
@vue_inventory = vue_walk(node)
|
76
|
-
@
|
77
|
+
@vue_methods = []
|
78
|
+
@vue_props = []
|
77
79
|
|
78
80
|
# collect instance methods (including getters and setters)
|
79
81
|
body.each do |statement|
|
80
82
|
if statement.type == :def
|
81
83
|
method = statement.children.first
|
82
84
|
unless VUE_LIFECYCLE.include? method or method == :initialize
|
83
|
-
|
84
|
-
|
85
|
+
if method.to_s.end_with? '='
|
86
|
+
method = method.to_s[0..-2].to_sym
|
87
|
+
@vue_props << method unless @vue_props.include? method
|
88
|
+
elsif statement.is_method?
|
89
|
+
@vue_methods << method unless @vue_methods.include? method
|
90
|
+
else
|
91
|
+
@vue_props << method unless @vue_props.include? method
|
92
|
+
end
|
85
93
|
end
|
86
94
|
end
|
87
95
|
end
|
@@ -226,7 +234,7 @@ module Ruby2JS
|
|
226
234
|
hash << s(:pair, s(:sym, :methods), s(:hash, *methods))
|
227
235
|
end
|
228
236
|
|
229
|
-
@
|
237
|
+
@vue_methods = []
|
230
238
|
|
231
239
|
# append setters to computed list
|
232
240
|
setters.each do |setter|
|
@@ -338,9 +346,20 @@ module Ruby2JS
|
|
338
346
|
end
|
339
347
|
|
340
348
|
# calls to methods (including getters) defined in this class
|
341
|
-
if node.children[0]==nil and
|
342
|
-
|
343
|
-
|
349
|
+
if node.children[0]==nil and Symbol === node.children[1]
|
350
|
+
if node.is_method?
|
351
|
+
if @vue_methods.include? node.children[1]
|
352
|
+
# calls to methods defined in this class
|
353
|
+
return node.updated nil, [s(:self), node.children[1],
|
354
|
+
*process_all(node.children[2..-1])]
|
355
|
+
end
|
356
|
+
else
|
357
|
+
if @vue_props.include? node.children[1]
|
358
|
+
# access to properties defined in this class
|
359
|
+
return node.updated nil, [s(:self), node.children[1],
|
360
|
+
*process_all(node.children[2..-1])]
|
361
|
+
end
|
362
|
+
end
|
344
363
|
end
|
345
364
|
|
346
365
|
return super unless @vue_h
|
@@ -863,7 +882,7 @@ module Ruby2JS
|
|
863
882
|
|
864
883
|
elsif
|
865
884
|
node.children.first.type == :lvasgn and
|
866
|
-
@
|
885
|
+
@vue_props.include? node.children[0].children[0]
|
867
886
|
then
|
868
887
|
node.updated nil, [s(:attr, s(:self),
|
869
888
|
node.children[0].children[0]),
|
@@ -876,7 +895,7 @@ module Ruby2JS
|
|
876
895
|
|
877
896
|
# for computed variables with setters, map x= to this.x=
|
878
897
|
def on_lvasgn(node)
|
879
|
-
return super unless @
|
898
|
+
return super unless @vue_props.include? node.children.first
|
880
899
|
s(:send, s(:self), "#{node.children.first}=",
|
881
900
|
process(node.children[1]))
|
882
901
|
end
|
data/lib/ruby2js/serializer.rb
CHANGED
data/lib/ruby2js/version.rb
CHANGED
data/ruby2js.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: ruby2js 2.1.
|
2
|
+
# stub: ruby2js 2.1.8 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "ruby2js".freeze
|
6
|
-
s.version = "2.1.
|
6
|
+
s.version = "2.1.8"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Sam Ruby".freeze]
|
11
|
-
s.date = "2017-09-
|
11
|
+
s.date = "2017-09-16"
|
12
12
|
s.description = " The base package maps Ruby syntax to JavaScript semantics.\n Filters may be provided to add Ruby-specific or framework specific\n behavior.\n".freeze
|
13
13
|
s.email = "rubys@intertwingly.net".freeze
|
14
14
|
s.files = ["README.md".freeze, "lib/ruby2js".freeze, "lib/ruby2js.rb".freeze, "lib/ruby2js/cgi.rb".freeze, "lib/ruby2js/converter".freeze, "lib/ruby2js/converter.rb".freeze, "lib/ruby2js/converter/arg.rb".freeze, "lib/ruby2js/converter/args.rb".freeze, "lib/ruby2js/converter/array.rb".freeze, "lib/ruby2js/converter/begin.rb".freeze, "lib/ruby2js/converter/block.rb".freeze, "lib/ruby2js/converter/blockpass.rb".freeze, "lib/ruby2js/converter/boolean.rb".freeze, "lib/ruby2js/converter/break.rb".freeze, "lib/ruby2js/converter/case.rb".freeze, "lib/ruby2js/converter/casgn.rb".freeze, "lib/ruby2js/converter/class.rb".freeze, "lib/ruby2js/converter/const.rb".freeze, "lib/ruby2js/converter/cvar.rb".freeze, "lib/ruby2js/converter/cvasgn.rb".freeze, "lib/ruby2js/converter/def.rb".freeze, "lib/ruby2js/converter/defined.rb".freeze, "lib/ruby2js/converter/defs.rb".freeze, "lib/ruby2js/converter/dstr.rb".freeze, "lib/ruby2js/converter/for.rb".freeze, "lib/ruby2js/converter/hash.rb".freeze, "lib/ruby2js/converter/if.rb".freeze, "lib/ruby2js/converter/in.rb".freeze, "lib/ruby2js/converter/ivar.rb".freeze, "lib/ruby2js/converter/ivasgn.rb".freeze, "lib/ruby2js/converter/kwbegin.rb".freeze, "lib/ruby2js/converter/literal.rb".freeze, "lib/ruby2js/converter/logical.rb".freeze, "lib/ruby2js/converter/masgn.rb".freeze, "lib/ruby2js/converter/module.rb".freeze, "lib/ruby2js/converter/next.rb".freeze, "lib/ruby2js/converter/nil.rb".freeze, "lib/ruby2js/converter/nthref.rb".freeze, "lib/ruby2js/converter/opasgn.rb".freeze, "lib/ruby2js/converter/prototype.rb".freeze, "lib/ruby2js/converter/regexp.rb".freeze, "lib/ruby2js/converter/return.rb".freeze, "lib/ruby2js/converter/self.rb".freeze, "lib/ruby2js/converter/send.rb".freeze, "lib/ruby2js/converter/super.rb".freeze, "lib/ruby2js/converter/sym.rb".freeze, "lib/ruby2js/converter/undef.rb".freeze, "lib/ruby2js/converter/until.rb".freeze, "lib/ruby2js/converter/untilpost.rb".freeze, "lib/ruby2js/converter/var.rb".freeze, "lib/ruby2js/converter/vasgn.rb".freeze, "lib/ruby2js/converter/while.rb".freeze, "lib/ruby2js/converter/whilepost.rb".freeze, "lib/ruby2js/converter/xstr.rb".freeze, "lib/ruby2js/execjs.rb".freeze, "lib/ruby2js/filter".freeze, "lib/ruby2js/filter/angular-resource.rb".freeze, "lib/ruby2js/filter/angular-route.rb".freeze, "lib/ruby2js/filter/angularrb.rb".freeze, "lib/ruby2js/filter/camelCase.rb".freeze, "lib/ruby2js/filter/functions.rb".freeze, "lib/ruby2js/filter/jquery.rb".freeze, "lib/ruby2js/filter/minitest-jasmine.rb".freeze, "lib/ruby2js/filter/react.rb".freeze, "lib/ruby2js/filter/require.rb".freeze, "lib/ruby2js/filter/return.rb".freeze, "lib/ruby2js/filter/rubyjs.rb".freeze, "lib/ruby2js/filter/strict.rb".freeze, "lib/ruby2js/filter/underscore.rb".freeze, "lib/ruby2js/filter/vue.rb".freeze, "lib/ruby2js/rails.rb".freeze, "lib/ruby2js/serializer.rb".freeze, "lib/ruby2js/sinatra.rb".freeze, "lib/ruby2js/version.rb".freeze, "ruby2js.gemspec".freeze]
|
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: 2.1.
|
4
|
+
version: 2.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|