active_interaction 3.7.0 → 3.8.3

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
  SHA256:
3
- metadata.gz: a5876e7199c749e87440e2a3d4efec4685e2d0b42ab167e5089ee9b014a44850
4
- data.tar.gz: 046dcc3fe7bd76e1572922904b6ea4568ff29674dc815a303a5e891d5ecf9019
3
+ metadata.gz: 883e2c22dbe4db00730bd2d917d7812e6f79898f41cfdcde16bc685b1ae1de29
4
+ data.tar.gz: 4c1af0be75d96c6801b288b450d260580b3d12f330ebeb69b1f6b20d88da5241
5
5
  SHA512:
6
- metadata.gz: c6491e9403f720062ecf1ac841b50d30f70f5309ae1ab6a35bcb473dd10030995676a0913c8ad6aec7698042f564a58a465281e5da0668fb6563422d169bf6f7
7
- data.tar.gz: 7078526498db343ee4d8893f57d44be58f40440fda73417e330e40ef944473261deef31e73eb16a685b0e4c5d57d3ac07e5d82c795f834b559f8a0881188ce31
6
+ metadata.gz: d2426683e3249c63760a59a25c0a7e8d21780bedf31218676ffca3d75903db0f4b73c18d80b78bbc568997ca67106490bac774bf43f68dacbe5ba00541e08e78
7
+ data.tar.gz: 412ae553643fd1449c9063058f5d4b8f39ea0bb97f4f166db73bee7ae6bf70a5f01b4ca8ee08a867417b8f7d83d57845d5168383c5ac69d2a931df7490527056
@@ -1,3 +1,35 @@
1
+ # [3.8.3][] (2020-04-22)
2
+
3
+ ## Fixed
4
+
5
+ - [486][] `valid?` returns true if block not called and error added in execute around callback.
6
+
7
+ # [3.8.2][] (2020-04-22)
8
+
9
+ ## Fixed
10
+
11
+ - [479][] Composed interactions that throw errors now show a complete backtrace instead of ending at the `run!` of the outermost interaction.
12
+
13
+ # [3.8.1][] (2020-04-04)
14
+
15
+ ## Fixed
16
+
17
+ - The implementation for providing a failing interaction on `InvalidInteractionError` was a breaking API change. It now works without breaking the API.
18
+
19
+ # [3.8.0][] (2020-02-28)
20
+
21
+ ## Added
22
+
23
+ - [#477][] `InvalidInteractionError` now provides access to the failing interaction by calling `interaction`.
24
+ - [#476][] Update `given?` to check for items in an array by passing an index.
25
+
26
+ # [3.7.1][] (2019-03-20)
27
+
28
+ ## Fixed
29
+
30
+ - [#455][] Switch to `BigDecimal()` to avoid warnings in Ruby 2.6.
31
+ - [#457][] When using an after callback on `execute` the `:if` option does not see composed errors.
32
+
1
33
  # [3.7.0][] (2019-02-10)
2
34
 
3
35
  ## Added
@@ -745,194 +777,205 @@ Example.run
745
777
 
746
778
  - Initial release.
747
779
 
748
- [3.7.0]: https://github.com/orgsync/active_interaction/compare/v3.6.2...v3.7.0
749
- [3.6.2]: https://github.com/orgsync/active_interaction/compare/v3.6.1...v3.6.2
750
- [3.6.1]: https://github.com/orgsync/active_interaction/compare/v3.6.0...v3.6.1
751
- [3.6.0]: https://github.com/orgsync/active_interaction/compare/v3.5.3...v3.6.0
752
- [3.5.3]: https://github.com/orgsync/active_interaction/compare/v3.5.2...v3.5.3
753
- [3.5.2]: https://github.com/orgsync/active_interaction/compare/v3.5.1...v3.5.2
754
- [3.5.1]: https://github.com/orgsync/active_interaction/compare/v3.5.0...v3.5.1
755
- [3.5.0]: https://github.com/orgsync/active_interaction/compare/v3.4.0...v3.5.0
756
- [3.4.0]: https://github.com/orgsync/active_interaction/compare/v3.3.0...v3.4.0
757
- [3.3.0]: https://github.com/orgsync/active_interaction/compare/v3.2.1...v3.3.0
758
- [3.2.1]: https://github.com/orgsync/active_interaction/compare/v3.2.0...v3.2.1
759
- [3.2.0]: https://github.com/orgsync/active_interaction/compare/v3.1.1...v3.2.0
760
- [3.1.1]: https://github.com/orgsync/active_interaction/compare/v3.1.0...v3.1.1
761
- [3.1.0]: https://github.com/orgsync/active_interaction/compare/v3.0.1...v3.1.0
762
- [3.0.1]: https://github.com/orgsync/active_interaction/compare/v3.0.0...v3.0.1
763
- [3.0.0]: https://github.com/orgsync/active_interaction/compare/v2.2.0...v3.0.0
764
- [2.2.0]: https://github.com/orgsync/active_interaction/compare/v2.1.5...v2.2.0
765
- [2.1.5]: https://github.com/orgsync/active_interaction/compare/v2.1.4...v2.1.5
766
- [2.1.4]: https://github.com/orgsync/active_interaction/compare/v2.1.3...v2.1.4
767
- [2.1.3]: https://github.com/orgsync/active_interaction/compare/v2.1.2...v2.1.3
768
- [2.1.2]: https://github.com/orgsync/active_interaction/compare/v2.1.1...v2.1.2
769
- [2.1.1]: https://github.com/orgsync/active_interaction/compare/v2.1.0...v2.1.1
770
- [2.1.0]: https://github.com/orgsync/active_interaction/compare/v2.0.1...v2.1.0
771
- [2.0.1]: https://github.com/orgsync/active_interaction/compare/v2.0.0...v2.0.1
772
- [2.0.0]: https://github.com/orgsync/active_interaction/compare/v1.6.0...v2.0.0
773
- [1.6.1]: https://github.com/orgsync/active_interaction/compare/v1.6.0...v1.6.1
774
- [1.6.0]: https://github.com/orgsync/active_interaction/compare/v1.5.1...v1.6.0
775
- [1.5.1]: https://github.com/orgsync/active_interaction/compare/v1.5.0...v1.5.1
776
- [1.5.0]: https://github.com/orgsync/active_interaction/compare/v1.4.1...v1.5.0
777
- [1.4.1]: https://github.com/orgsync/active_interaction/compare/v1.4.0...v1.4.1
778
- [1.4.0]: https://github.com/orgsync/active_interaction/compare/v1.3.1...v1.4.0
779
- [1.3.1]: https://github.com/orgsync/active_interaction/compare/v1.3.0...v1.3.1
780
- [1.3.0]: https://github.com/orgsync/active_interaction/compare/v1.2.5...v1.3.0
781
- [1.2.5]: https://github.com/orgsync/active_interaction/compare/v1.2.4...v1.2.5
782
- [1.2.4]: https://github.com/orgsync/active_interaction/compare/v1.2.3...v1.2.4
783
- [1.2.3]: https://github.com/orgsync/active_interaction/compare/v1.2.2...v1.2.3
784
- [1.2.2]: https://github.com/orgsync/active_interaction/compare/v1.2.1...v1.2.2
785
- [1.2.1]: https://github.com/orgsync/active_interaction/compare/v1.2.0...v1.2.1
786
- [1.2.0]: https://github.com/orgsync/active_interaction/compare/v1.1.7...v1.2.0
787
- [1.1.7]: https://github.com/orgsync/active_interaction/compare/v1.1.6...v1.1.7
788
- [1.1.6]: https://github.com/orgsync/active_interaction/compare/v1.1.5...v1.1.6
789
- [1.1.5]: https://github.com/orgsync/active_interaction/compare/v1.1.4...v1.1.5
790
- [1.1.4]: https://github.com/orgsync/active_interaction/compare/v1.1.3...v1.1.4
791
- [1.1.3]: https://github.com/orgsync/active_interaction/compare/v1.1.2...v1.1.3
792
- [1.1.2]: https://github.com/orgsync/active_interaction/compare/v1.1.1...v1.1.2
793
- [1.1.1]: https://github.com/orgsync/active_interaction/compare/v1.1.0...v1.1.1
794
- [1.1.0]: https://github.com/orgsync/active_interaction/compare/v1.0.5...v1.1.0
795
- [1.0.5]: https://github.com/orgsync/active_interaction/compare/v1.0.4...v1.0.5
796
- [1.0.4]: https://github.com/orgsync/active_interaction/compare/v1.0.3...v1.0.4
797
- [1.0.3]: https://github.com/orgsync/active_interaction/compare/v1.0.2...v1.0.3
798
- [1.0.2]: https://github.com/orgsync/active_interaction/compare/v1.0.1...v1.0.2
799
- [1.0.1]: https://github.com/orgsync/active_interaction/compare/v1.0.0...v1.0.1
800
- [1.0.0]: https://github.com/orgsync/active_interaction/compare/v0.10.2...v1.0.0
801
- [0.10.2]: https://github.com/orgsync/active_interaction/compare/v0.10.1...v0.10.2
802
- [0.10.1]: https://github.com/orgsync/active_interaction/compare/v0.10.0...v0.10.1
803
- [0.10.0]: https://github.com/orgsync/active_interaction/compare/v0.9.1...v0.10.0
804
- [0.9.1]: https://github.com/orgsync/active_interaction/compare/v0.9.0...v0.9.1
805
- [0.9.0]: https://github.com/orgsync/active_interaction/compare/v0.8.0...v0.9.0
806
- [0.8.0]: https://github.com/orgsync/active_interaction/compare/v0.7.0...v0.8.0
807
- [0.7.0]: https://github.com/orgsync/active_interaction/compare/v0.6.1...v0.7.0
808
- [0.6.1]: https://github.com/orgsync/active_interaction/compare/v0.6.0...v0.6.1
809
- [0.6.0]: https://github.com/orgsync/active_interaction/compare/v0.5.0...v0.6.0
810
- [0.5.0]: https://github.com/orgsync/active_interaction/compare/v0.4.0...v0.5.0
811
- [0.4.0]: https://github.com/orgsync/active_interaction/compare/v0.3.0...v0.4.0
812
- [0.3.0]: https://github.com/orgsync/active_interaction/compare/v0.2.2...v0.3.0
813
- [0.2.2]: https://github.com/orgsync/active_interaction/compare/v0.2.1...v0.2.2
814
- [0.2.1]: https://github.com/orgsync/active_interaction/compare/v0.2.0...v0.2.1
815
- [0.2.0]: https://github.com/orgsync/active_interaction/compare/v0.1.3...v0.2.0
816
- [0.1.3]: https://github.com/orgsync/active_interaction/compare/v0.1.2...v0.1.3
817
- [0.1.2]: https://github.com/orgsync/active_interaction/compare/v0.1.1...v0.1.2
818
- [0.1.1]: https://github.com/orgsync/active_interaction/compare/v0.1.0...v0.1.1
819
- [0.1.0]: https://github.com/orgsync/active_interaction/compare/v0.0.0...v0.1.0
820
-
821
- [#20]: https://github.com/orgsync/active_interaction/issues/20
822
- [#23]: https://github.com/orgsync/active_interaction/issues/23
823
- [#24]: https://github.com/orgsync/active_interaction/issues/24
824
- [#27]: https://github.com/orgsync/active_interaction/issues/27
825
- [#28]: https://github.com/orgsync/active_interaction/issues/28
826
- [#29]: https://github.com/orgsync/active_interaction/issues/29
827
- [#30]: https://github.com/orgsync/active_interaction/issues/30
828
- [#34]: https://github.com/orgsync/active_interaction/issues/34
829
- [#36]: https://github.com/orgsync/active_interaction/issues/36
830
- [#37]: https://github.com/orgsync/active_interaction/issues/37
831
- [#38]: https://github.com/orgsync/active_interaction/issues/38
832
- [#39]: https://github.com/orgsync/active_interaction/issues/39
833
- [#40]: https://github.com/orgsync/active_interaction/issues/40
834
- [#41]: https://github.com/orgsync/active_interaction/issues/41
835
- [#44]: https://github.com/orgsync/active_interaction/issues/44
836
- [#45]: https://github.com/orgsync/active_interaction/issues/45
837
- [#49]: https://github.com/orgsync/active_interaction/issues/49
838
- [#56]: https://github.com/orgsync/active_interaction/issues/56
839
- [#57]: https://github.com/orgsync/active_interaction/issues/57
840
- [#58]: https://github.com/orgsync/active_interaction/issues/58
841
- [#61]: https://github.com/orgsync/active_interaction/issues/61
842
- [#66]: https://github.com/orgsync/active_interaction/issues/66
843
- [#77]: https://github.com/orgsync/active_interaction/issues/77
844
- [#82]: https://github.com/orgsync/active_interaction/issues/82
845
- [#84]: https://github.com/orgsync/active_interaction/issues/84
846
- [#88]: https://github.com/orgsync/active_interaction/issues/88
847
- [#89]: https://github.com/orgsync/active_interaction/issues/89
848
- [#90]: https://github.com/orgsync/active_interaction/issues/90
849
- [#94]: https://github.com/orgsync/active_interaction/issues/94
850
- [#98]: https://github.com/orgsync/active_interaction/issues/98
851
- [#102]: https://github.com/orgsync/active_interaction/issues/102
852
- [#103]: https://github.com/orgsync/active_interaction/issues/103
853
- [#104]: https://github.com/orgsync/active_interaction/issues/104
854
- [#106]: https://github.com/orgsync/active_interaction/issues/106
855
- [#111]: https://github.com/orgsync/active_interaction/issues/111
856
- [#114]: https://github.com/orgsync/active_interaction/issues/114
857
- [#115]: https://github.com/orgsync/active_interaction/issues/115
858
- [#116]: https://github.com/orgsync/active_interaction/issues/116
859
- [#119]: https://github.com/orgsync/active_interaction/issues/119
860
- [#122]: https://github.com/orgsync/active_interaction/issues/122
861
- [#125]: https://github.com/orgsync/active_interaction/issues/125
862
- [#127]: https://github.com/orgsync/active_interaction/issues/127
863
- [#128]: https://github.com/orgsync/active_interaction/issues/128
864
- [#129]: https://github.com/orgsync/active_interaction/issues/129
865
- [#130]: https://github.com/orgsync/active_interaction/issues/130
866
- [#134]: https://github.com/orgsync/active_interaction/issues/134
867
- [#135]: https://github.com/orgsync/active_interaction/issues/135
868
- [#136]: https://github.com/orgsync/active_interaction/issues/136
869
- [#138]: https://github.com/orgsync/active_interaction/issues/138
870
- [#140]: https://github.com/orgsync/active_interaction/issues/140
871
- [#143]: https://github.com/orgsync/active_interaction/issues/143
872
- [#153]: https://github.com/orgsync/active_interaction/issues/153
873
- [#155]: https://github.com/orgsync/active_interaction/issues/155
874
- [#156]: https://github.com/orgsync/active_interaction/issues/156
875
- [#163]: https://github.com/orgsync/active_interaction/issues/163
876
- [#164]: https://github.com/orgsync/active_interaction/issues/164
877
- [#165]: https://github.com/orgsync/active_interaction/issues/165
878
- [#173]: https://github.com/orgsync/active_interaction/issues/173
879
- [#174]: https://github.com/orgsync/active_interaction/issues/174
880
- [#175]: https://github.com/orgsync/active_interaction/issues/175
881
- [#178]: https://github.com/orgsync/active_interaction/issues/178
882
- [#179]: https://github.com/orgsync/active_interaction/issues/179
883
- [#192]: https://github.com/orgsync/active_interaction/issues/192
884
- [#196]: https://github.com/orgsync/active_interaction/issues/196
885
- [#201]: https://github.com/orgsync/active_interaction/issues/201
886
- [#203]: https://github.com/orgsync/active_interaction/issues/203
887
- [#206]: https://github.com/orgsync/active_interaction/issues/206
888
- [#207]: https://github.com/orgsync/active_interaction/issues/207
889
- [#213]: https://github.com/orgsync/active_interaction/issues/213
890
- [#214]: https://github.com/orgsync/active_interaction/issues/214
891
- [#215]: https://github.com/orgsync/active_interaction/issues/215
892
- [#224]: https://github.com/orgsync/active_interaction/issues/224
893
- [#235]: https://github.com/orgsync/active_interaction/issues/235
894
- [#236]: https://github.com/orgsync/active_interaction/issues/236
895
- [#239]: https://github.com/orgsync/active_interaction/issues/239
896
- [#244]: https://github.com/orgsync/active_interaction/issues/244
897
- [#248]: https://github.com/orgsync/active_interaction/issues/248
898
- [#250]: https://github.com/orgsync/active_interaction/issues/250
899
- [#256]: https://github.com/orgsync/active_interaction/issues/256
900
- [#264]: https://github.com/orgsync/active_interaction/issues/264
901
- [#265]: https://github.com/orgsync/active_interaction/issues/265
902
- [#269]: https://github.com/orgsync/active_interaction/issues/269
903
- [#286]: https://github.com/orgsync/active_interaction/issues/286
904
- [#289]: https://github.com/orgsync/active_interaction/issues/289
905
- [#295]: https://github.com/orgsync/active_interaction/issues/295
906
- [#296]: https://github.com/orgsync/active_interaction/issues/296
907
- [#298]: https://github.com/orgsync/active_interaction/issues/298
908
- [#303]: https://github.com/orgsync/active_interaction/issues/303
909
- [#304]: https://github.com/orgsync/active_interaction/issues/304
910
- [#310]: https://github.com/orgsync/active_interaction/issues/310
911
- [#311]: https://github.com/orgsync/active_interaction/issues/311
912
- [#320]: https://github.com/orgsync/active_interaction/issues/320
913
- [#330]: https://github.com/orgsync/active_interaction/pull/330
914
- [#332]: https://github.com/orgsync/active_interaction/pull/332
915
- [#333]: https://github.com/orgsync/active_interaction/pull/333
916
- [#336]: https://github.com/orgsync/active_interaction/pull/336
917
- [#344]: https://github.com/orgsync/active_interaction/pull/344
918
- [#346]: https://github.com/orgsync/active_interaction/pull/346
919
- [#349]: https://github.com/orgsync/active_interaction/pull/349
920
- [#357]: https://github.com/orgsync/active_interaction/pull/357
921
- [#362]: https://github.com/orgsync/active_interaction/pull/362
922
- [#364]: https://github.com/orgsync/active_interaction/pull/364
923
- [#365]: https://github.com/orgsync/active_interaction/pull/365
924
- [#370]: https://github.com/orgsync/active_interaction/pull/370
925
- [#377]: https://github.com/orgsync/active_interaction/pull/377
926
- [#383]: https://github.com/orgsync/active_interaction/pull/383
927
- [#384]: https://github.com/orgsync/active_interaction/pull/384
928
- [#387]: https://github.com/orgsync/active_interaction/pull/387
929
- [#408]: https://github.com/orgsync/active_interaction/pull/408
930
- [#411]: https://github.com/orgsync/active_interaction/pull/411
931
- [#415]: https://github.com/orgsync/active_interaction/pull/415
932
- [#417]: https://github.com/orgsync/active_interaction/pull/417
933
- [#420]: https://github.com/orgsync/active_interaction/pull/420
934
- [#422]: https://github.com/orgsync/active_interaction/pull/422
935
- [#425]: https://github.com/orgsync/active_interaction/pull/425
936
- [#429]: https://github.com/orgsync/active_interaction/pull/429
937
- [#435]: https://github.com/orgsync/active_interaction/pull/435
938
- [#454]: https://github.com/orgsync/active_interaction/pull/454
780
+ [3.8.3]: https://github.com/AaronLasseigne/active_interaction/compare/v3.8.2...v3.8.3
781
+ [3.8.2]: https://github.com/AaronLasseigne/active_interaction/compare/v3.8.1...v3.8.2
782
+ [3.8.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.8.0...v3.8.1
783
+ [3.8.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.7.1...v3.8.0
784
+ [3.7.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.7.0...v3.7.1
785
+ [3.7.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.6.2...v3.7.0
786
+ [3.6.2]: https://github.com/AaronLasseigne/active_interaction/compare/v3.6.1...v3.6.2
787
+ [3.6.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.6.0...v3.6.1
788
+ [3.6.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.5.3...v3.6.0
789
+ [3.5.3]: https://github.com/AaronLasseigne/active_interaction/compare/v3.5.2...v3.5.3
790
+ [3.5.2]: https://github.com/AaronLasseigne/active_interaction/compare/v3.5.1...v3.5.2
791
+ [3.5.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.5.0...v3.5.1
792
+ [3.5.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.4.0...v3.5.0
793
+ [3.4.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.3.0...v3.4.0
794
+ [3.3.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.2.1...v3.3.0
795
+ [3.2.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.2.0...v3.2.1
796
+ [3.2.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.1.1...v3.2.0
797
+ [3.1.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.1.0...v3.1.1
798
+ [3.1.0]: https://github.com/AaronLasseigne/active_interaction/compare/v3.0.1...v3.1.0
799
+ [3.0.1]: https://github.com/AaronLasseigne/active_interaction/compare/v3.0.0...v3.0.1
800
+ [3.0.0]: https://github.com/AaronLasseigne/active_interaction/compare/v2.2.0...v3.0.0
801
+ [2.2.0]: https://github.com/AaronLasseigne/active_interaction/compare/v2.1.5...v2.2.0
802
+ [2.1.5]: https://github.com/AaronLasseigne/active_interaction/compare/v2.1.4...v2.1.5
803
+ [2.1.4]: https://github.com/AaronLasseigne/active_interaction/compare/v2.1.3...v2.1.4
804
+ [2.1.3]: https://github.com/AaronLasseigne/active_interaction/compare/v2.1.2...v2.1.3
805
+ [2.1.2]: https://github.com/AaronLasseigne/active_interaction/compare/v2.1.1...v2.1.2
806
+ [2.1.1]: https://github.com/AaronLasseigne/active_interaction/compare/v2.1.0...v2.1.1
807
+ [2.1.0]: https://github.com/AaronLasseigne/active_interaction/compare/v2.0.1...v2.1.0
808
+ [2.0.1]: https://github.com/AaronLasseigne/active_interaction/compare/v2.0.0...v2.0.1
809
+ [2.0.0]: https://github.com/AaronLasseigne/active_interaction/compare/v1.6.0...v2.0.0
810
+ [1.6.1]: https://github.com/AaronLasseigne/active_interaction/compare/v1.6.0...v1.6.1
811
+ [1.6.0]: https://github.com/AaronLasseigne/active_interaction/compare/v1.5.1...v1.6.0
812
+ [1.5.1]: https://github.com/AaronLasseigne/active_interaction/compare/v1.5.0...v1.5.1
813
+ [1.5.0]: https://github.com/AaronLasseigne/active_interaction/compare/v1.4.1...v1.5.0
814
+ [1.4.1]: https://github.com/AaronLasseigne/active_interaction/compare/v1.4.0...v1.4.1
815
+ [1.4.0]: https://github.com/AaronLasseigne/active_interaction/compare/v1.3.1...v1.4.0
816
+ [1.3.1]: https://github.com/AaronLasseigne/active_interaction/compare/v1.3.0...v1.3.1
817
+ [1.3.0]: https://github.com/AaronLasseigne/active_interaction/compare/v1.2.5...v1.3.0
818
+ [1.2.5]: https://github.com/AaronLasseigne/active_interaction/compare/v1.2.4...v1.2.5
819
+ [1.2.4]: https://github.com/AaronLasseigne/active_interaction/compare/v1.2.3...v1.2.4
820
+ [1.2.3]: https://github.com/AaronLasseigne/active_interaction/compare/v1.2.2...v1.2.3
821
+ [1.2.2]: https://github.com/AaronLasseigne/active_interaction/compare/v1.2.1...v1.2.2
822
+ [1.2.1]: https://github.com/AaronLasseigne/active_interaction/compare/v1.2.0...v1.2.1
823
+ [1.2.0]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.7...v1.2.0
824
+ [1.1.7]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.6...v1.1.7
825
+ [1.1.6]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.5...v1.1.6
826
+ [1.1.5]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.4...v1.1.5
827
+ [1.1.4]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.3...v1.1.4
828
+ [1.1.3]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.2...v1.1.3
829
+ [1.1.2]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.1...v1.1.2
830
+ [1.1.1]: https://github.com/AaronLasseigne/active_interaction/compare/v1.1.0...v1.1.1
831
+ [1.1.0]: https://github.com/AaronLasseigne/active_interaction/compare/v1.0.5...v1.1.0
832
+ [1.0.5]: https://github.com/AaronLasseigne/active_interaction/compare/v1.0.4...v1.0.5
833
+ [1.0.4]: https://github.com/AaronLasseigne/active_interaction/compare/v1.0.3...v1.0.4
834
+ [1.0.3]: https://github.com/AaronLasseigne/active_interaction/compare/v1.0.2...v1.0.3
835
+ [1.0.2]: https://github.com/AaronLasseigne/active_interaction/compare/v1.0.1...v1.0.2
836
+ [1.0.1]: https://github.com/AaronLasseigne/active_interaction/compare/v1.0.0...v1.0.1
837
+ [1.0.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.10.2...v1.0.0
838
+ [0.10.2]: https://github.com/AaronLasseigne/active_interaction/compare/v0.10.1...v0.10.2
839
+ [0.10.1]: https://github.com/AaronLasseigne/active_interaction/compare/v0.10.0...v0.10.1
840
+ [0.10.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.9.1...v0.10.0
841
+ [0.9.1]: https://github.com/AaronLasseigne/active_interaction/compare/v0.9.0...v0.9.1
842
+ [0.9.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.8.0...v0.9.0
843
+ [0.8.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.7.0...v0.8.0
844
+ [0.7.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.6.1...v0.7.0
845
+ [0.6.1]: https://github.com/AaronLasseigne/active_interaction/compare/v0.6.0...v0.6.1
846
+ [0.6.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.5.0...v0.6.0
847
+ [0.5.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.4.0...v0.5.0
848
+ [0.4.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.3.0...v0.4.0
849
+ [0.3.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.2.2...v0.3.0
850
+ [0.2.2]: https://github.com/AaronLasseigne/active_interaction/compare/v0.2.1...v0.2.2
851
+ [0.2.1]: https://github.com/AaronLasseigne/active_interaction/compare/v0.2.0...v0.2.1
852
+ [0.2.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.1.3...v0.2.0
853
+ [0.1.3]: https://github.com/AaronLasseigne/active_interaction/compare/v0.1.2...v0.1.3
854
+ [0.1.2]: https://github.com/AaronLasseigne/active_interaction/compare/v0.1.1...v0.1.2
855
+ [0.1.1]: https://github.com/AaronLasseigne/active_interaction/compare/v0.1.0...v0.1.1
856
+ [0.1.0]: https://github.com/AaronLasseigne/active_interaction/compare/v0.0.0...v0.1.0
857
+
858
+ [#20]: https://github.com/AaronLasseigne/active_interaction/issues/20
859
+ [#23]: https://github.com/AaronLasseigne/active_interaction/issues/23
860
+ [#24]: https://github.com/AaronLasseigne/active_interaction/issues/24
861
+ [#27]: https://github.com/AaronLasseigne/active_interaction/issues/27
862
+ [#28]: https://github.com/AaronLasseigne/active_interaction/issues/28
863
+ [#29]: https://github.com/AaronLasseigne/active_interaction/issues/29
864
+ [#30]: https://github.com/AaronLasseigne/active_interaction/issues/30
865
+ [#34]: https://github.com/AaronLasseigne/active_interaction/issues/34
866
+ [#36]: https://github.com/AaronLasseigne/active_interaction/issues/36
867
+ [#37]: https://github.com/AaronLasseigne/active_interaction/issues/37
868
+ [#38]: https://github.com/AaronLasseigne/active_interaction/issues/38
869
+ [#39]: https://github.com/AaronLasseigne/active_interaction/issues/39
870
+ [#40]: https://github.com/AaronLasseigne/active_interaction/issues/40
871
+ [#41]: https://github.com/AaronLasseigne/active_interaction/issues/41
872
+ [#44]: https://github.com/AaronLasseigne/active_interaction/issues/44
873
+ [#45]: https://github.com/AaronLasseigne/active_interaction/issues/45
874
+ [#49]: https://github.com/AaronLasseigne/active_interaction/issues/49
875
+ [#56]: https://github.com/AaronLasseigne/active_interaction/issues/56
876
+ [#57]: https://github.com/AaronLasseigne/active_interaction/issues/57
877
+ [#58]: https://github.com/AaronLasseigne/active_interaction/issues/58
878
+ [#61]: https://github.com/AaronLasseigne/active_interaction/issues/61
879
+ [#66]: https://github.com/AaronLasseigne/active_interaction/issues/66
880
+ [#77]: https://github.com/AaronLasseigne/active_interaction/issues/77
881
+ [#82]: https://github.com/AaronLasseigne/active_interaction/issues/82
882
+ [#84]: https://github.com/AaronLasseigne/active_interaction/issues/84
883
+ [#88]: https://github.com/AaronLasseigne/active_interaction/issues/88
884
+ [#89]: https://github.com/AaronLasseigne/active_interaction/issues/89
885
+ [#90]: https://github.com/AaronLasseigne/active_interaction/issues/90
886
+ [#94]: https://github.com/AaronLasseigne/active_interaction/issues/94
887
+ [#98]: https://github.com/AaronLasseigne/active_interaction/issues/98
888
+ [#102]: https://github.com/AaronLasseigne/active_interaction/issues/102
889
+ [#103]: https://github.com/AaronLasseigne/active_interaction/issues/103
890
+ [#104]: https://github.com/AaronLasseigne/active_interaction/issues/104
891
+ [#106]: https://github.com/AaronLasseigne/active_interaction/issues/106
892
+ [#111]: https://github.com/AaronLasseigne/active_interaction/issues/111
893
+ [#114]: https://github.com/AaronLasseigne/active_interaction/issues/114
894
+ [#115]: https://github.com/AaronLasseigne/active_interaction/issues/115
895
+ [#116]: https://github.com/AaronLasseigne/active_interaction/issues/116
896
+ [#119]: https://github.com/AaronLasseigne/active_interaction/issues/119
897
+ [#122]: https://github.com/AaronLasseigne/active_interaction/issues/122
898
+ [#125]: https://github.com/AaronLasseigne/active_interaction/issues/125
899
+ [#127]: https://github.com/AaronLasseigne/active_interaction/issues/127
900
+ [#128]: https://github.com/AaronLasseigne/active_interaction/issues/128
901
+ [#129]: https://github.com/AaronLasseigne/active_interaction/issues/129
902
+ [#130]: https://github.com/AaronLasseigne/active_interaction/issues/130
903
+ [#134]: https://github.com/AaronLasseigne/active_interaction/issues/134
904
+ [#135]: https://github.com/AaronLasseigne/active_interaction/issues/135
905
+ [#136]: https://github.com/AaronLasseigne/active_interaction/issues/136
906
+ [#138]: https://github.com/AaronLasseigne/active_interaction/issues/138
907
+ [#140]: https://github.com/AaronLasseigne/active_interaction/issues/140
908
+ [#143]: https://github.com/AaronLasseigne/active_interaction/issues/143
909
+ [#153]: https://github.com/AaronLasseigne/active_interaction/issues/153
910
+ [#155]: https://github.com/AaronLasseigne/active_interaction/issues/155
911
+ [#156]: https://github.com/AaronLasseigne/active_interaction/issues/156
912
+ [#163]: https://github.com/AaronLasseigne/active_interaction/issues/163
913
+ [#164]: https://github.com/AaronLasseigne/active_interaction/issues/164
914
+ [#165]: https://github.com/AaronLasseigne/active_interaction/issues/165
915
+ [#173]: https://github.com/AaronLasseigne/active_interaction/issues/173
916
+ [#174]: https://github.com/AaronLasseigne/active_interaction/issues/174
917
+ [#175]: https://github.com/AaronLasseigne/active_interaction/issues/175
918
+ [#178]: https://github.com/AaronLasseigne/active_interaction/issues/178
919
+ [#179]: https://github.com/AaronLasseigne/active_interaction/issues/179
920
+ [#192]: https://github.com/AaronLasseigne/active_interaction/issues/192
921
+ [#196]: https://github.com/AaronLasseigne/active_interaction/issues/196
922
+ [#201]: https://github.com/AaronLasseigne/active_interaction/issues/201
923
+ [#203]: https://github.com/AaronLasseigne/active_interaction/issues/203
924
+ [#206]: https://github.com/AaronLasseigne/active_interaction/issues/206
925
+ [#207]: https://github.com/AaronLasseigne/active_interaction/issues/207
926
+ [#213]: https://github.com/AaronLasseigne/active_interaction/issues/213
927
+ [#214]: https://github.com/AaronLasseigne/active_interaction/issues/214
928
+ [#215]: https://github.com/AaronLasseigne/active_interaction/issues/215
929
+ [#224]: https://github.com/AaronLasseigne/active_interaction/issues/224
930
+ [#235]: https://github.com/AaronLasseigne/active_interaction/issues/235
931
+ [#236]: https://github.com/AaronLasseigne/active_interaction/issues/236
932
+ [#239]: https://github.com/AaronLasseigne/active_interaction/issues/239
933
+ [#244]: https://github.com/AaronLasseigne/active_interaction/issues/244
934
+ [#248]: https://github.com/AaronLasseigne/active_interaction/issues/248
935
+ [#250]: https://github.com/AaronLasseigne/active_interaction/issues/250
936
+ [#256]: https://github.com/AaronLasseigne/active_interaction/issues/256
937
+ [#264]: https://github.com/AaronLasseigne/active_interaction/issues/264
938
+ [#265]: https://github.com/AaronLasseigne/active_interaction/issues/265
939
+ [#269]: https://github.com/AaronLasseigne/active_interaction/issues/269
940
+ [#286]: https://github.com/AaronLasseigne/active_interaction/issues/286
941
+ [#289]: https://github.com/AaronLasseigne/active_interaction/issues/289
942
+ [#295]: https://github.com/AaronLasseigne/active_interaction/issues/295
943
+ [#296]: https://github.com/AaronLasseigne/active_interaction/issues/296
944
+ [#298]: https://github.com/AaronLasseigne/active_interaction/issues/298
945
+ [#303]: https://github.com/AaronLasseigne/active_interaction/issues/303
946
+ [#304]: https://github.com/AaronLasseigne/active_interaction/issues/304
947
+ [#310]: https://github.com/AaronLasseigne/active_interaction/issues/310
948
+ [#311]: https://github.com/AaronLasseigne/active_interaction/issues/311
949
+ [#320]: https://github.com/AaronLasseigne/active_interaction/issues/320
950
+ [#330]: https://github.com/AaronLasseigne/active_interaction/pull/330
951
+ [#332]: https://github.com/AaronLasseigne/active_interaction/pull/332
952
+ [#333]: https://github.com/AaronLasseigne/active_interaction/pull/333
953
+ [#336]: https://github.com/AaronLasseigne/active_interaction/pull/336
954
+ [#344]: https://github.com/AaronLasseigne/active_interaction/pull/344
955
+ [#346]: https://github.com/AaronLasseigne/active_interaction/pull/346
956
+ [#349]: https://github.com/AaronLasseigne/active_interaction/issues/349
957
+ [#357]: https://github.com/AaronLasseigne/active_interaction/issues/357
958
+ [#362]: https://github.com/AaronLasseigne/active_interaction/pull/362
959
+ [#364]: https://github.com/AaronLasseigne/active_interaction/pull/364
960
+ [#365]: https://github.com/AaronLasseigne/active_interaction/pull/365
961
+ [#370]: https://github.com/AaronLasseigne/active_interaction/pull/370
962
+ [#377]: https://github.com/AaronLasseigne/active_interaction/pull/377
963
+ [#383]: https://github.com/AaronLasseigne/active_interaction/pull/383
964
+ [#384]: https://github.com/AaronLasseigne/active_interaction/issues/384
965
+ [#387]: https://github.com/AaronLasseigne/active_interaction/pull/387
966
+ [#408]: https://github.com/AaronLasseigne/active_interaction/issues/408
967
+ [#411]: https://github.com/AaronLasseigne/active_interaction/issues/411
968
+ [#415]: https://github.com/AaronLasseigne/active_interaction/issues/415
969
+ [#417]: https://github.com/AaronLasseigne/active_interaction/issues/417
970
+ [#420]: https://github.com/AaronLasseigne/active_interaction/issues/420
971
+ [#422]: https://github.com/AaronLasseigne/active_interaction/issues/422
972
+ [#425]: https://github.com/AaronLasseigne/active_interaction/issues/425
973
+ [#429]: https://github.com/AaronLasseigne/active_interaction/issues/429
974
+ [#435]: https://github.com/AaronLasseigne/active_interaction/issues/435
975
+ [#454]: https://github.com/AaronLasseigne/active_interaction/pull/454
976
+ [#455]: https://github.com/AaronLasseigne/active_interaction/pull/455
977
+ [#457]: https://github.com/AaronLasseigne/active_interaction/issues/457
978
+ [#477]: https://github.com/AaronLasseigne/active_interaction/issues/477
979
+ [#476]: https://github.com/AaronLasseigne/active_interaction/issues/476
980
+ [#479]: https://github.com/AaronLasseigne/active_interaction/issues/479
981
+ [#486]: https://github.com/AaronLasseigne/active_interaction/issues/486
@@ -10,4 +10,4 @@
10
10
 
11
11
  Running the tests using `rake` (with no args) will also check for style issues in the code. Ideally all submissions would pass these checks. If the code style is causing issues (particularly the method or class size) we can work with you to correct it. Don't let it stop you from contributing.
12
12
 
13
- [fork]: https://github.com/orgsync/active_interaction/fork
13
+ [fork]: https://github.com/AaronLasseigne/active_interaction/fork
data/README.md CHANGED
@@ -66,13 +66,13 @@ handles your verbs.
66
66
  Add it to your Gemfile:
67
67
 
68
68
  ``` rb
69
- gem 'active_interaction', '~> 3.7'
69
+ gem 'active_interaction', '~> 3.8'
70
70
  ```
71
71
 
72
72
  Or install it manually:
73
73
 
74
74
  ``` sh
75
- $ gem install active_interaction --version '~> 3.7'
75
+ $ gem install active_interaction --version '~> 3.8'
76
76
  ```
77
77
 
78
78
  This project uses [Semantic Versioning][]. Check out [GitHub releases][] for a
@@ -378,6 +378,25 @@ InterfaceInteraction.run!(serializer: JSON)
378
378
  # => "{\"is_json\":true}"
379
379
  ```
380
380
 
381
+ NOTE: The `methods` option is optional.
382
+
383
+ ```rb
384
+ class InterfaceInteraction < ActiveInteraction::Base
385
+ interface :anything
386
+
387
+ def execute
388
+ anything.class
389
+ end
390
+ end
391
+
392
+ require 'json'
393
+
394
+ InterfaceInteraction.run!(anything: Hash.new)
395
+ # => Hash
396
+ InterfaceInteraction.run!
397
+ # => NilClass
398
+ ```
399
+
381
400
  ### Object
382
401
 
383
402
  Object filters allow you to require an instance of a particular class. It
@@ -614,7 +633,7 @@ end
614
633
 
615
634
  DecimalInteraction.run!(price: 'one ninety-nine')
616
635
  # ActiveInteraction::InvalidInteractionError: Price is not a valid decimal
617
- DecimalInteraction.run!(price: BigDecimal.new(1.99, 2))
636
+ DecimalInteraction.run!(price: BigDecimal(1.99, 2))
618
637
  # => #<BigDecimal:7fe792a42028,'0.2165E1',18(45)>
619
638
  ```
620
639
 
@@ -668,7 +687,7 @@ sensible (e.g. `base: 10`).
668
687
  class IntegerInteraction < ActiveInteraction::Base
669
688
  integer :limit1, base: 10
670
689
  integer :limit2
671
-
690
+
672
691
  def execute
673
692
  [limit1, limit2]
674
693
  end
@@ -1322,7 +1341,8 @@ whether a value was passed to `run` or the result of a filter default. In
1322
1341
  particular, it is useful when `nil` is an acceptable value. For example, you
1323
1342
  may optionally track your users' birthdays. You can use the `given?` predicate
1324
1343
  to see if an input was even passed to `run`. With `given?` you can also check
1325
- the input of a hash filter by passing a series of keys to check.
1344
+ the input of a hash or array filter by passing a series of keys or indexes to
1345
+ check.
1326
1346
 
1327
1347
  ``` rb
1328
1348
  class UpdateUser < ActiveInteraction::Base
@@ -28,7 +28,7 @@ module ActiveInteraction
28
28
  # else
29
29
  # outcome.errors
30
30
  # end
31
- class Base
31
+ class Base # rubocop:disable Metrics/ClassLength
32
32
  include ActiveModelable
33
33
  include ActiveRecordable
34
34
  include Runnable
@@ -203,7 +203,8 @@ module ActiveInteraction
203
203
  # Returns `true` if the given key was in the hash passed to {.run}.
204
204
  # Otherwise returns `false`. Use this to figure out if an input was given,
205
205
  # even if it was `nil`. Keys within nested hash filter can also be checked
206
- # by passing them in series.
206
+ # by passing them in series. Arrays can be checked in the same manor as
207
+ # hashes by passing an index.
207
208
  #
208
209
  # @example
209
210
  # class Example < ActiveInteraction::Base
@@ -219,32 +220,49 @@ module ActiveInteraction
219
220
  # hash :x, default: {} do
220
221
  # integer :y, default: nil
221
222
  # end
222
- # def execute; given?(:x, :y) end
223
+ # array :a, default: [] do
224
+ # integer
225
+ # end
226
+ # def execute; given?(:x, :y) || given?(:a, 2) end
223
227
  # end
224
228
  # Example.run!() # => false
225
229
  # Example.run!(x: nil) # => false
226
230
  # Example.run!(x: {}) # => false
227
231
  # Example.run!(x: { y: nil }) # => true
228
232
  # Example.run!(x: { y: rand }) # => true
233
+ # Example.run!(a: [1, 2]) # => false
234
+ # Example.run!(a: [1, 2, 3]) # => true
229
235
  #
230
236
  # @param input [#to_sym]
231
237
  #
232
238
  # @return [Boolean]
233
239
  #
234
240
  # @since 2.1.0
235
- def given?(input, *rest) # rubocop:disable Metrics/CyclomaticComplexity
241
+ # rubocop:disable all
242
+ def given?(input, *rest)
236
243
  filter_level = self.class
237
244
  input_level = @_interaction_inputs
238
245
 
239
- [input, *rest].map(&:to_sym).each do |key|
240
- filter_level = filter_level.filters[key]
246
+ [input, *rest].each do |key_or_index|
247
+ if key_or_index.is_a?(Symbol) || key_or_index.is_a?(String)
248
+ key_or_index = key_or_index.to_sym
249
+ filter_level = filter_level.filters[key_or_index]
250
+
251
+ break false if filter_level.nil? || input_level.nil?
252
+ break false unless input_level.key?(key_or_index) || input_level.key?(key_or_index.to_s)
241
253
 
242
- break false if filter_level.nil? || input_level.nil?
243
- break false unless input_level.key?(key) || input_level.key?(key.to_s)
254
+ input_level = input_level[key_or_index] || input_level[key_or_index.to_s]
255
+ else
256
+ filter_level = filter_level.filters.first.last
244
257
 
245
- input_level = input_level[key] || input_level[key.to_s]
258
+ break false if filter_level.nil? || input_level.nil?
259
+ break false unless key_or_index.between?(-input_level.size, input_level.size - 1)
260
+
261
+ input_level = input_level[key_or_index]
262
+ end
246
263
  end && true
247
264
  end
265
+ # rubocop:enable all
248
266
 
249
267
  protected
250
268
 
@@ -71,24 +71,17 @@ module ActiveInteraction
71
71
 
72
72
  # @return (see #result=)
73
73
  # @return [nil]
74
- def run # rubocop:disable MethodLength
75
- self.result =
76
- if valid?
77
- result_or_errors = run_callbacks(:execute) do
78
- begin
79
- execute
80
- rescue Interrupt => interrupt
81
- interrupt.errors
82
- end
83
- end
84
-
85
- if result_or_errors.is_a?(ActiveInteraction::Errors)
86
- errors.merge!(result_or_errors)
87
- nil
88
- else
89
- result_or_errors
90
- end
74
+ def run
75
+ return self.result = nil unless valid?
76
+
77
+ self.result = run_callbacks(:execute) do
78
+ begin
79
+ execute
80
+ rescue Interrupt => interrupt
81
+ errors.backtrace = interrupt.errors.backtrace || interrupt.backtrace
82
+ errors.merge!(interrupt.errors)
91
83
  end
84
+ end
92
85
  end
93
86
 
94
87
  # @return [Object]
@@ -97,11 +90,12 @@ module ActiveInteraction
97
90
  def run!
98
91
  run
99
92
 
100
- unless valid?
101
- raise InvalidInteractionError, errors.full_messages.join(', ')
102
- end
93
+ return result if valid?
103
94
 
104
- result
95
+ e = InvalidInteractionError.new(errors.full_messages.join(', '))
96
+ e.interaction = self
97
+ e.set_backtrace(errors.backtrace) if errors.backtrace
98
+ raise e
105
99
  end
106
100
 
107
101
  #
@@ -31,7 +31,9 @@ module ActiveInteraction
31
31
  # Raised if an interaction is invalid.
32
32
  #
33
33
  # @return [Class]
34
- InvalidInteractionError = Class.new(Error)
34
+ class InvalidInteractionError < Error
35
+ attr_accessor :interaction
36
+ end
35
37
 
36
38
  # Raised if a user-supplied value is invalid.
37
39
  #
@@ -90,6 +92,8 @@ module ActiveInteraction
90
92
 
91
93
  # An extension that provides the ability to merge other errors into itself.
92
94
  class Errors < ActiveModel::Errors
95
+ attr_accessor :backtrace
96
+
93
97
  # Merge other errors into this one.
94
98
  #
95
99
  # @param other [Errors]
@@ -25,7 +25,7 @@ module ActiveInteraction
25
25
  def cast(value, _interaction)
26
26
  case value
27
27
  when Numeric
28
- BigDecimal.new(value, digits)
28
+ BigDecimal(value, digits)
29
29
  when String
30
30
  decimal_from_string(value)
31
31
  else
@@ -47,7 +47,7 @@ module ActiveInteraction
47
47
  # @raise [InvalidValueError] if given value can not be converted
48
48
  def decimal_from_string(value)
49
49
  Float(value)
50
- BigDecimal.new(value, digits)
50
+ BigDecimal(value, digits)
51
51
  rescue ArgumentError
52
52
  raise InvalidValueError, "Given value: #{value.inspect}"
53
53
  end
@@ -0,0 +1,24 @@
1
+ ja:
2
+ active_interaction:
3
+ errors:
4
+ messages:
5
+ invalid: は無効です
6
+ invalid_nested: は無効なネストされた値です (%{name} => %{value})
7
+ invalid_type: は無効な %{type} です
8
+ missing: が必要です
9
+ types:
10
+ array: 配列
11
+ boolean: ブール
12
+ date: 日付
13
+ date_time: 日時
14
+ decimal: 10進数
15
+ file: ファイル
16
+ float: 浮動小数点数
17
+ hash: ハッシュ
18
+ integer: 整数
19
+ interface: インターフェース
20
+ object: オブジェクト
21
+ record: レコード
22
+ string: 文字
23
+ symbol: シンボル
24
+ time: 時間
@@ -17,8 +17,14 @@ module ActiveInteraction
17
17
  def reserved?(name)
18
18
  name.to_s.start_with?('_interaction_') ||
19
19
  name == :syscall ||
20
- Base.method_defined?(name) ||
21
- Base.private_method_defined?(name)
20
+ (
21
+ Base.method_defined?(name) &&
22
+ !Object.method_defined?(name)
23
+ ) ||
24
+ (
25
+ Base.private_method_defined?(name) &&
26
+ !Object.private_method_defined?(name)
27
+ )
22
28
  end
23
29
 
24
30
  def process(inputs)
@@ -6,5 +6,5 @@ module ActiveInteraction
6
6
  # The version number.
7
7
  #
8
8
  # @return [Gem::Version]
9
- VERSION = Gem::Version.new('3.7.0')
9
+ VERSION = Gem::Version.new('3.8.3')
10
10
  end
@@ -24,6 +24,12 @@ InterruptInteraction = Class.new(TestInteraction) do
24
24
  class: Object,
25
25
  default: nil
26
26
 
27
+ # NOTE: the relative position between this method
28
+ # and the compose line should be preserved.
29
+ def self.composition_location
30
+ "#{__FILE__}:#{__LINE__ + 4}:in `execute'"
31
+ end
32
+
27
33
  def execute
28
34
  compose(AddInteraction, x: x, y: z)
29
35
  end
@@ -371,6 +377,15 @@ describe ActiveInteraction::Base do
371
377
  expect(outcome.errors.details)
372
378
  .to eql(x: [{ error: :missing }], base: [{ error: 'Y is required' }])
373
379
  end
380
+
381
+ it 'has the correct backtrace' do
382
+ begin
383
+ described_class.run!(inputs)
384
+ rescue ActiveInteraction::InvalidInteractionError => e
385
+ expect(e.backtrace)
386
+ .to include(InterruptInteraction.composition_location)
387
+ end
388
+ end
374
389
  end
375
390
  end
376
391
 
@@ -505,6 +520,79 @@ describe ActiveInteraction::Base do
505
520
  expect(result).to be false
506
521
  end
507
522
  end
523
+
524
+ context 'nested array values' do
525
+ let(:described_class) do
526
+ Class.new(TestInteraction) do
527
+ array :x do
528
+ hash do
529
+ boolean :y, default: true
530
+ end
531
+ end
532
+
533
+ def execute; end
534
+ end
535
+ end
536
+
537
+ context 'has a positive index' do
538
+ it 'returns true if found' do
539
+ described_class.class_exec do
540
+ def execute
541
+ given?(:x, 0, :y)
542
+ end
543
+ end
544
+
545
+ inputs[:x] = [{ y: true }]
546
+ expect(result).to be true
547
+ end
548
+
549
+ it 'returns false if not found' do
550
+ described_class.class_exec do
551
+ def execute
552
+ given?(:x, 0, :y)
553
+ end
554
+ end
555
+
556
+ inputs[:x] = []
557
+ expect(result).to be false
558
+ end
559
+ end
560
+
561
+ context 'has a negative index' do
562
+ it 'returns true if found' do
563
+ described_class.class_exec do
564
+ def execute
565
+ given?(:x, -1, :y)
566
+ end
567
+ end
568
+
569
+ inputs[:x] = [{ y: true }]
570
+ expect(result).to be true
571
+ end
572
+
573
+ it 'returns false if not found' do
574
+ described_class.class_exec do
575
+ def execute
576
+ given?(:x, -1, :y)
577
+ end
578
+ end
579
+
580
+ inputs[:x] = []
581
+ expect(result).to be false
582
+ end
583
+ end
584
+
585
+ it 'returns false if you go too far' do
586
+ described_class.class_exec do
587
+ def execute
588
+ given?(:x, 10, :y)
589
+ end
590
+ end
591
+
592
+ inputs[:x] = [{}]
593
+ expect(result).to be false
594
+ end
595
+ end
508
596
  end
509
597
 
510
598
  context 'inheritance' do
@@ -103,6 +103,20 @@ describe ActiveInteraction::Runnable do
103
103
  WithFailingCompose.run
104
104
  expect(has_run).to be_truthy
105
105
  end
106
+
107
+ context 'using if' do
108
+ it 'yields errors to the if' do
109
+ has_run = false
110
+ # rubocop:disable Metrics/LineLength
111
+ WithFailingCompose.set_callback :execute, :after, if: -> { errors.any? } do
112
+ has_run = true
113
+ end
114
+ # rubocop:enable Metrics/LineLength
115
+
116
+ WithFailingCompose.run
117
+ expect(has_run).to be_truthy
118
+ end
119
+ end
106
120
  end
107
121
  end
108
122
  end
@@ -331,6 +345,24 @@ describe ActiveInteraction::Runnable do
331
345
  expect(outcome.caught_error).to be true
332
346
  end
333
347
  end
348
+
349
+ context 'with block not called and error in execute around callback' do
350
+ class CheckExecuteAroundCallbackForFailure
351
+ include ActiveInteraction::ActiveModelable
352
+ include ActiveInteraction::Runnable
353
+
354
+ set_callback :execute, :around, -> { errors.add(:base, 'invalid') }
355
+
356
+ def execute
357
+ true
358
+ end
359
+ end
360
+
361
+ it 'is invalid' do
362
+ outcome = CheckExecuteAroundCallbackForFailure.run
363
+ expect(outcome).to_not be_valid
364
+ end
365
+ end
334
366
  end
335
367
 
336
368
  describe '.run!' do
@@ -355,6 +387,12 @@ describe ActiveInteraction::Runnable do
355
387
  result
356
388
  end.to raise_error ActiveInteraction::InvalidInteractionError
357
389
  end
390
+
391
+ it 'adds interaction instance to this error' do
392
+ expect { result }.to raise_error do |error|
393
+ expect(error.interaction).to be_a klass
394
+ end
395
+ end
358
396
  end
359
397
  end
360
398
  end
@@ -1,6 +1,17 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
+ require 'active_record'
5
+ unless defined?(JRUBY_VERSION) # rubocop:disable Style/IfUnlessModifier
6
+ require 'sqlite3'
7
+ end
8
+
9
+ unless defined?(JRUBY_VERSION)
10
+ ActiveRecord::Base.establish_connection(
11
+ adapter: 'sqlite3',
12
+ database: ':memory:'
13
+ )
14
+ end
4
15
 
5
16
  describe ActiveInteraction::Errors do
6
17
  let(:klass) do
@@ -148,5 +159,42 @@ describe ActiveInteraction::Errors do
148
159
  expect(errors.messages[:base]).to include message
149
160
  end
150
161
  end
162
+
163
+ unless defined?(JRUBY_VERSION)
164
+ context 'with nested errors' do
165
+ before do
166
+ # suppress create_table output
167
+ allow($stdout).to receive(:puts)
168
+ ActiveRecord::Schema.define do
169
+ create_table(:as)
170
+ create_table(:bs) do |t|
171
+ t.column :a_id, :integer
172
+ t.column :name, :string
173
+ end
174
+ end
175
+
176
+ class A < ActiveRecord::Base
177
+ has_one :b
178
+ accepts_nested_attributes_for :b
179
+ end
180
+
181
+ class B < ActiveRecord::Base
182
+ belongs_to :a
183
+
184
+ validates :name, presence: true
185
+ end
186
+ end
187
+
188
+ let(:a) { A.create(b_attributes: { name: nil }) }
189
+
190
+ it 'merges the nested errors' do
191
+ a.valid?
192
+ expect(a.errors.messages).to eql(:'b.name' => ["can't be blank"])
193
+ expect(a.errors.size).to eql 1
194
+ expect { errors.merge!(a.errors) }.to_not raise_error
195
+ expect(errors.size).to eql 1
196
+ end
197
+ end
198
+ end
151
199
  end
152
200
  end
@@ -21,7 +21,7 @@ describe ActiveInteraction::DecimalFilter, :filter do
21
21
  let(:value) { rand }
22
22
 
23
23
  it 'returns the BigDecimal' do
24
- expect(result).to eql BigDecimal.new(value, 0)
24
+ expect(result).to eql BigDecimal(value, 0)
25
25
  end
26
26
 
27
27
  context 'with :digits option' do
@@ -30,7 +30,7 @@ describe ActiveInteraction::DecimalFilter, :filter do
30
30
  let(:value) { 1.23456789 }
31
31
 
32
32
  it 'returns BigDecimal with given digits' do
33
- expect(result).to eql BigDecimal.new('1.235')
33
+ expect(result).to eql BigDecimal('1.235')
34
34
  end
35
35
  end
36
36
  end
@@ -39,7 +39,7 @@ describe ActiveInteraction::DecimalFilter, :filter do
39
39
  let(:value) { rand(1 << 16) }
40
40
 
41
41
  it 'returns a BigDecimal' do
42
- expect(result).to eql BigDecimal.new(value)
42
+ expect(result).to eql BigDecimal(value)
43
43
  end
44
44
  end
45
45
 
@@ -47,7 +47,7 @@ describe ActiveInteraction::DecimalFilter, :filter do
47
47
  let(:value) { rand.to_s }
48
48
 
49
49
  it 'returns a BigDecimal' do
50
- expect(result).to eql BigDecimal.new(value)
50
+ expect(result).to eql BigDecimal(value)
51
51
  end
52
52
  end
53
53
 
@@ -1,14 +1,28 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
+ require 'active_record'
5
+ unless defined?(JRUBY_VERSION) # rubocop:disable Style/IfUnlessModifier
6
+ require 'sqlite3'
7
+ end
8
+
9
+ unless defined?(JRUBY_VERSION)
10
+ ActiveRecord::Base.establish_connection(
11
+ adapter: 'sqlite3',
12
+ database: ':memory:'
13
+ )
4
14
 
5
- module ActiveRecord
6
- class Relation
15
+ ActiveRecord::Schema.define do
16
+ create_table(:lists)
17
+ create_table(:elements) { |t| t.column(:list_id, :integer) }
7
18
  end
8
19
 
9
- module Associations
10
- class CollectionProxy
11
- end
20
+ class List < ActiveRecord::Base
21
+ has_many :elements
22
+ end
23
+
24
+ class Element < ActiveRecord::Base
25
+ belongs_to :list
12
26
  end
13
27
  end
14
28
 
@@ -24,9 +38,10 @@ end
24
38
  describe ArrayInteraction do
25
39
  include_context 'interactions'
26
40
  it_behaves_like 'an interaction', :array, -> { [] }
27
- it_behaves_like 'an interaction', :array, -> { ActiveRecord::Relation.new }
28
- it_behaves_like 'an interaction', :array,
29
- -> { ActiveRecord::Associations::CollectionProxy.new }
41
+ unless defined?(JRUBY_VERSION)
42
+ it_behaves_like 'an interaction', :array, -> { Element.where('1 = 1') }
43
+ it_behaves_like 'an interaction', :array, -> { List.create!.elements }
44
+ end
30
45
 
31
46
  context 'with inputs[:a]' do
32
47
  let(:a) { [[]] }
@@ -8,14 +8,16 @@ describe ActiveInteraction::InputProcessor do
8
8
  expect(described_class.reserved?('_interaction_')).to be_truthy
9
9
  end
10
10
 
11
+ # rubocop:disable Metrics/LineLength
11
12
  it 'returns true for existing instance methods' do
12
13
  (
13
- ActiveInteraction::Base.instance_methods +
14
- ActiveInteraction::Base.private_instance_methods
14
+ (ActiveInteraction::Base.instance_methods - Object.instance_methods) +
15
+ (ActiveInteraction::Base.private_instance_methods - Object.private_instance_methods)
15
16
  ).each do |method|
16
17
  expect(described_class.reserved?(method)).to be_truthy
17
18
  end
18
19
  end
20
+ # rubocop:enable Metrics/LineLength
19
21
 
20
22
  it 'returns false for anything else' do
21
23
  expect(described_class.reserved?(SecureRandom.hex)).to be_falsey
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_interaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
8
8
  - Taylor Fausak
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-11 00:00:00.000000000 Z
12
+ date: 2020-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -45,6 +45,20 @@ dependencies:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: activerecord
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: benchmark-ips
50
64
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +157,20 @@ dependencies:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0.9'
160
+ - !ruby/object:Gem::Dependency
161
+ name: sqlite3
162
+ requirement: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '='
165
+ - !ruby/object:Gem::Version
166
+ version: 1.4.2
167
+ type: :development
168
+ prerelease: false
169
+ version_requirements: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 1.4.2
146
174
  description: |2
147
175
  ActiveInteraction manages application-specific business logic. It is an
148
176
  implementation of the command pattern in Ruby.
@@ -190,6 +218,7 @@ files:
190
218
  - lib/active_interaction/locale/en.yml
191
219
  - lib/active_interaction/locale/fr.yml
192
220
  - lib/active_interaction/locale/it.yml
221
+ - lib/active_interaction/locale/ja.yml
193
222
  - lib/active_interaction/locale/pt-BR.yml
194
223
  - lib/active_interaction/modules/input_processor.rb
195
224
  - lib/active_interaction/modules/validation.rb
@@ -242,14 +271,14 @@ files:
242
271
  - spec/support/concerns.rb
243
272
  - spec/support/filters.rb
244
273
  - spec/support/interactions.rb
245
- homepage:
274
+ homepage:
246
275
  licenses:
247
276
  - MIT
248
277
  metadata:
249
278
  homepage_uri: https://github.com/AaronLasseigne/active_interaction
250
279
  source_code_uri: https://github.com/AaronLasseigne/active_interaction
251
280
  changelog_uri: https://github.com/AaronLasseigne/active_interaction/blob/master/CHANGELOG.md
252
- post_install_message:
281
+ post_install_message:
253
282
  rdoc_options: []
254
283
  require_paths:
255
284
  - lib
@@ -264,8 +293,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
293
  - !ruby/object:Gem::Version
265
294
  version: '0'
266
295
  requirements: []
267
- rubygems_version: 3.0.1
268
- signing_key:
296
+ rubygems_version: 3.1.2
297
+ signing_key:
269
298
  specification_version: 4
270
299
  summary: Manage application specific business logic.
271
300
  test_files: