ruby2js 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby2js/filter/vue.rb +42 -3
- 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: '08e0daaccf6d0c253ce1f592c6f4450165a0b7cf'
|
4
|
+
data.tar.gz: d98f7229563f4117d27d1bbd02d7773ce34c3a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f2034b25a657087e47b66f094b6b3933b575636fdef15028506640db10748035d5a159d978b09d84547a161f7190e833660eb8923255ac4f5553dde1f3b9c75
|
7
|
+
data.tar.gz: 709f7d21bb0ae7a475933ff18e776091711a1a20e386cbba1176893954a9f84c44782ca6457c82e76a16954280a70200cc69a8d3f7585b8099f7bb2b1aad0562
|
data/lib/ruby2js/filter/vue.rb
CHANGED
@@ -188,6 +188,7 @@ module Ruby2JS
|
|
188
188
|
# add to hash in the appropriate location
|
189
189
|
pair = s(:pair, s(:sym, method.to_s.chomp('=')),
|
190
190
|
s(:block, s(:send, nil, method_type), args, process(block)))
|
191
|
+
@comments[pair] = @comments[statement]
|
191
192
|
if VUE_LIFECYCLE.include? method
|
192
193
|
hash << pair
|
193
194
|
elsif not statement.is_method?
|
@@ -250,18 +251,56 @@ module Ruby2JS
|
|
250
251
|
end
|
251
252
|
|
252
253
|
# convert class name to camel case
|
253
|
-
|
254
|
+
cname = cname.children.last
|
255
|
+
camel = cname.to_s.gsub(/[^\w]/, '-').
|
254
256
|
sub(/^[A-Z]/) {|c| c.downcase}.
|
255
257
|
gsub(/[A-Z]/) {|c| "-#{c.downcase}"}
|
256
258
|
|
257
259
|
if inheritance == s(:const, nil, :Vue)
|
258
260
|
# build component
|
259
|
-
s(:casgn, nil, cname
|
261
|
+
defn = s(:casgn, nil, cname,
|
260
262
|
s(:send, s(:const, nil, :Vue), :component,
|
261
263
|
s(:str, camel), s(:hash, *hash)))
|
262
264
|
else
|
263
265
|
# build mixin
|
264
|
-
s(:casgn, nil, cname
|
266
|
+
defn = s(:casgn, nil, cname, s(:hash, *hash))
|
267
|
+
end
|
268
|
+
|
269
|
+
# append class methods (if any)
|
270
|
+
class_methods = body.select do |statement|
|
271
|
+
statement.type == :defs and statement.children[0] == s(:self)
|
272
|
+
end
|
273
|
+
|
274
|
+
if class_methods.empty?
|
275
|
+
defn
|
276
|
+
else
|
277
|
+
s(:begin, defn, *process_all(class_methods.map {|method|
|
278
|
+
fn = if method.is_method?
|
279
|
+
# class method
|
280
|
+
s(:send, s(:const, nil, cname), "#{method.children[1]}=",
|
281
|
+
s(:block, s(:send , nil, :proc), *method.children[2..-1]))
|
282
|
+
|
283
|
+
elsif
|
284
|
+
method.children.length == 4 and
|
285
|
+
Converter::EXPRESSIONS.include? method.children[3].type
|
286
|
+
then
|
287
|
+
# class property - simple
|
288
|
+
s(:send, s(:const, nil, cname), "#{method.children[1]}=",
|
289
|
+
method.children[3])
|
290
|
+
|
291
|
+
else
|
292
|
+
# class computed property
|
293
|
+
s(:send, s(:const, nil, :Object), :defineProperty,
|
294
|
+
s(:const, nil, cname), s(:str, method.children[1].to_s),
|
295
|
+
s(:hash, s(:pair, s(:sym, :enumerable), s(:true)),
|
296
|
+
s(:pair, s(:sym, :configurable), s(:true)),
|
297
|
+
s(:pair, s(:sym, :get), s(:block, s(:send, nil, :proc),
|
298
|
+
*method.children[2..-1]))))
|
299
|
+
end
|
300
|
+
|
301
|
+
@comments[fn] = @comments[method]
|
302
|
+
fn
|
303
|
+
}))
|
265
304
|
end
|
266
305
|
end
|
267
306
|
|
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.6 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.6"
|
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-12"
|
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.6
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|