ruby2js 2.1.13 → 2.1.14

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
  SHA1:
3
- metadata.gz: aa0964592b03f2fb107cd059b0be53ce6af09f2c
4
- data.tar.gz: 6e6d30ac12b9814b00bd975cf18fe293e64a5fda
3
+ metadata.gz: 7142ef3a080ba4a5342d66a8b08a99389172cb74
4
+ data.tar.gz: 4cb6bb9b94504d1ba771f4605e6a886afb35e4a5
5
5
  SHA512:
6
- metadata.gz: 4cbb3f66dc9ca5f90194c014dca58e16eb84fa2f968edef959b5b9556b13261825cbcc6b6d59d7d8ecbf1e9a10739b93c7288a4ac2166f8c623e35f77d08b6ab
7
- data.tar.gz: ecc003b41211afd67b5de07d266a51c1664d58a3a7f74548419cde92f76eec944a49ed2c37b7656d112137a2d3f615c5493daaa5a4e5d84db45bf1b8c9fc8c2f
6
+ metadata.gz: ab2b9562a0fda5be938edfd54fe713208459d4b062e38be7559571ca15af266cd5fdc5d0ca0c52a6361b5460446d3d156448e70c56d877522525e3ec900f9990
7
+ data.tar.gz: d4dc3b4d5f713ff050d7f26581dbb05690a20e09eb6f02612682c4365c6ad0828e9759039ed28bafc0637a260b6198a2e277649260a7f06f8735cda3529b6389
@@ -21,6 +21,7 @@ module Ruby2JS
21
21
  ]
22
22
 
23
23
  def initialize(*args)
24
+ @vue_class = nil
24
25
  @vue_h = nil
25
26
  @vue_self = nil
26
27
  @vue_apply = nil
@@ -44,9 +45,15 @@ module Ruby2JS
44
45
  # s(:hash)))
45
46
  def on_class(node)
46
47
  cname, inheritance, *body = node.children
47
- return super unless cname.children.first == nil
48
- return super unless inheritance == s(:const, nil, :Vue) or
49
- inheritance == s(:const, s(:const, nil, :Vue), :Mixin)
48
+
49
+ begin
50
+ vue_class, @vue_class = @vue_class, cname
51
+ return super unless cname.children.first == nil
52
+ return super unless inheritance == s(:const, nil, :Vue) or
53
+ inheritance == s(:const, s(:const, nil, :Vue), :Mixin)
54
+ ensure
55
+ @vue_class = vue_class
56
+ end
50
57
 
51
58
  # traverse down to actual list of class statements
52
59
  if body.length == 1
@@ -372,16 +379,36 @@ module Ruby2JS
372
379
  # expand 'wunderbar' like method calls
373
380
  def on_send(node)
374
381
  if not @vue_h
375
- # enable React filtering within Vue class method calls or
376
- # React component calls
377
- if
378
- node.children.first == s(:const, nil, :Vue)
379
- then
380
- begin
381
- vue_h, @vue_h = @vue_h, [s(:self), :$createElement]
382
- return on_send(node)
383
- ensure
384
- @vue_h = vue_h
382
+ if node.children.first == s(:const, nil, :Vue)
383
+ # enable React filtering within Vue class method calls or
384
+ # React component calls
385
+ begin
386
+ vue_h, @vue_h = @vue_h, [s(:self), :$createElement]
387
+ return on_send(node)
388
+ ensure
389
+ @vue_h = vue_h
390
+ end
391
+
392
+ elsif node.children.first == s(:send, s(:const, nil, :Vue), :util)
393
+ if node.children[1] == :defineReactive
394
+ if node.children.length == 4 and @vue_class
395
+ var = node.children[2]
396
+ if var.type == :cvar
397
+ scope = @vue_class
398
+ var = s(:str, '_' + var.children[0].to_s[2..-1])
399
+ elsif var.type == :ivar
400
+ scope = s(:self)
401
+ var = s(:str, '_' + var.children[0].to_s[1..-1])
402
+ elsif var.type == :send and var.children.length == 2
403
+ scope = var.children[0]
404
+ var = s(:sym, var.children[1])
405
+ else
406
+ return super
407
+ end
408
+
409
+ return node.updated nil, [*node.children[0..1],
410
+ scope, process(var), *process_all(node.children[3..-1])]
411
+ end
385
412
  end
386
413
  end
387
414
  end
@@ -2,7 +2,7 @@ module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- TINY = 13
5
+ TINY = 14
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/ruby2js.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ruby2js 2.1.13 ruby lib
2
+ # stub: ruby2js 2.1.14 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ruby2js".freeze
6
- s.version = "2.1.13"
6
+ s.version = "2.1.14"
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-28"
11
+ s.date = "2017-09-29"
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.13
4
+ version: 2.1.14
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-28 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser