ruby2js 2.1.14 → 2.1.15
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 +46 -7
- data/lib/ruby2js/version.rb +1 -1
- data/ruby2js.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 121d094f331f90e10cd459c3a1f4b22276582ff9
|
4
|
+
data.tar.gz: db0ef09b980ac15ed08e009cf3a09191c4dd32b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '049e26bdf2fda7434b19073fd51a931f4b7655e134f7b73167015b7a175dfd8ad6e05719d63841ef115c909872bd623475b9c774a8d271ec4d997fd74a3c37ba'
|
7
|
+
data.tar.gz: 8d4f7975ba5036f8e5b55b0db6a2ec2f4d457260451583a13d051506db8ac35acc659aec78323f7ec3a6c5d26b5a4d0b000507f85bc7c0d716fdab2c4fad2e22
|
data/lib/ruby2js/filter/vue.rb
CHANGED
@@ -610,7 +610,17 @@ module Ruby2JS
|
|
610
610
|
hash['nativeOn']['input'] ||
|
611
611
|
hash['nativeOn']['change']
|
612
612
|
|
613
|
-
|
613
|
+
# test if value is assignable
|
614
|
+
test = value
|
615
|
+
while
|
616
|
+
test and test.type == :send and test.children.length == 2 and
|
617
|
+
test.children.last.instance_of? Symbol do
|
618
|
+
test = test.children.first
|
619
|
+
end
|
620
|
+
|
621
|
+
if value and (not test or
|
622
|
+
test.is_a? Symbol or [:ivar, :cvar].include? test.type)
|
623
|
+
then
|
614
624
|
hash[:domProps]['value'] ||= value
|
615
625
|
hash[:domProps]['textContent'] ||= value if tag == 'textarea'
|
616
626
|
hash[:attrs].delete('value')
|
@@ -623,10 +633,20 @@ module Ruby2JS
|
|
623
633
|
|
624
634
|
# define event handler to update ivar on input events
|
625
635
|
if not onChange
|
636
|
+
update = s(:attr, s(:attr, s(:lvar, :event), :target), :value)
|
637
|
+
|
638
|
+
if value.type == :ivar
|
639
|
+
assign = s(:ivasgn, value.children.first, update)
|
640
|
+
elsif value.type == :cvar
|
641
|
+
assign = s(:cvasgn, value.children.first, update)
|
642
|
+
else
|
643
|
+
assign = value.updated nil, [value.children.first,
|
644
|
+
"#{value.children[1]}=", update]
|
645
|
+
end
|
646
|
+
|
626
647
|
hash['on']['input'] ||=
|
627
648
|
s(:block, s(:send, nil, :proc), s(:args, s(:arg, :event)),
|
628
|
-
|
629
|
-
s(:attr, s(:attr, s(:lvar, :event), :target), :value)))
|
649
|
+
assign)
|
630
650
|
end
|
631
651
|
end
|
632
652
|
|
@@ -634,7 +654,17 @@ module Ruby2JS
|
|
634
654
|
# search for the presence of a 'checked' attribute
|
635
655
|
checked = hash[:attrs]['checked']
|
636
656
|
|
637
|
-
|
657
|
+
# test if value is assignable
|
658
|
+
test = checked
|
659
|
+
while
|
660
|
+
test and test.type == :send and test.children.length == 2 and
|
661
|
+
test.children.last.instance_of? Symbol do
|
662
|
+
test = test.children.first
|
663
|
+
end
|
664
|
+
|
665
|
+
if checked and (not test or
|
666
|
+
test.is_a? Symbol or [:ivar, :cvar].include? test.type)
|
667
|
+
then
|
638
668
|
hash[:domProps]['checked'] ||= checked
|
639
669
|
hash[:attrs].delete('checked')
|
640
670
|
|
@@ -646,10 +676,19 @@ module Ruby2JS
|
|
646
676
|
|
647
677
|
# define event handler to update ivar on click events
|
648
678
|
if not onChange
|
679
|
+
update = s(:send, checked, :!)
|
680
|
+
|
681
|
+
if checked.type == :ivar
|
682
|
+
assign = s(:ivasgn, checked.children.first, update)
|
683
|
+
elsif checked.type == :cvar
|
684
|
+
assign = s(:cvasgn, checked.children.first, update)
|
685
|
+
else
|
686
|
+
assign = checked.updated nil, [checked.children.first,
|
687
|
+
"#{checked.children[1]}=", update]
|
688
|
+
end
|
689
|
+
|
649
690
|
hash['on']['click'] ||=
|
650
|
-
s(:block, s(:send, nil, :proc), s(:args),
|
651
|
-
s(:ivasgn,checked.children.first,
|
652
|
-
s(:send, checked, :!)))
|
691
|
+
s(:block, s(:send, nil, :proc), s(:args), assign)
|
653
692
|
end
|
654
693
|
end
|
655
694
|
end
|
data/lib/ruby2js/version.rb
CHANGED
data/ruby2js.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: ruby2js 2.1.
|
2
|
+
# stub: ruby2js 2.1.15 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.15"
|
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]
|