activeinteractor 1.2.1 → 2.0.0.alpha.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -3
  3. data/LICENSE +1 -1
  4. data/README.md +4 -64
  5. data/lib/active_interactor/base.rb +77 -29
  6. data/lib/active_interactor/errors.rb +12 -0
  7. data/lib/active_interactor/result.rb +73 -0
  8. data/lib/active_interactor.rb +3 -101
  9. data/sig/active_interactor.rbs +3 -0
  10. metadata +24 -207
  11. data/.yardopts +0 -12
  12. data/lib/active_interactor/config.rb +0 -60
  13. data/lib/active_interactor/configurable.rb +0 -53
  14. data/lib/active_interactor/context/attributes.rb +0 -179
  15. data/lib/active_interactor/context/base.rb +0 -333
  16. data/lib/active_interactor/context/errors.rb +0 -57
  17. data/lib/active_interactor/context/loader.rb +0 -50
  18. data/lib/active_interactor/context/status.rb +0 -106
  19. data/lib/active_interactor/error.rb +0 -46
  20. data/lib/active_interactor/interactor/callbacks.rb +0 -293
  21. data/lib/active_interactor/interactor/context.rb +0 -378
  22. data/lib/active_interactor/interactor/perform.rb +0 -260
  23. data/lib/active_interactor/interactor/worker.rb +0 -114
  24. data/lib/active_interactor/models.rb +0 -50
  25. data/lib/active_interactor/organizer/base.rb +0 -18
  26. data/lib/active_interactor/organizer/callbacks.rb +0 -275
  27. data/lib/active_interactor/organizer/interactor_interface.rb +0 -127
  28. data/lib/active_interactor/organizer/interactor_interface_collection.rb +0 -62
  29. data/lib/active_interactor/organizer/organize.rb +0 -67
  30. data/lib/active_interactor/organizer/perform.rb +0 -113
  31. data/lib/active_interactor/rails/orm/active_record.rb +0 -5
  32. data/lib/active_interactor/rails/orm/dynamoid.rb +0 -5
  33. data/lib/active_interactor/rails/orm/mongoid.rb +0 -5
  34. data/lib/active_interactor/rails/railtie.rb +0 -21
  35. data/lib/active_interactor/rails.rb +0 -4
  36. data/lib/active_interactor/version.rb +0 -45
  37. data/lib/rails/generators/active_interactor/application_context_generator.rb +0 -21
  38. data/lib/rails/generators/active_interactor/application_interactor_generator.rb +0 -21
  39. data/lib/rails/generators/active_interactor/application_organizer_generator.rb +0 -21
  40. data/lib/rails/generators/active_interactor/base.rb +0 -29
  41. data/lib/rails/generators/active_interactor/generator.rb +0 -21
  42. data/lib/rails/generators/active_interactor/install_generator.rb +0 -16
  43. data/lib/rails/generators/active_interactor.rb +0 -5
  44. data/lib/rails/generators/interactor/context/rspec_generator.rb +0 -17
  45. data/lib/rails/generators/interactor/context/test_unit_generator.rb +0 -17
  46. data/lib/rails/generators/interactor/context_generator.rb +0 -22
  47. data/lib/rails/generators/interactor/generates_context.rb +0 -28
  48. data/lib/rails/generators/interactor/interactor_generator.rb +0 -25
  49. data/lib/rails/generators/interactor/organizer_generator.rb +0 -39
  50. data/lib/rails/generators/interactor/rspec_generator.rb +0 -15
  51. data/lib/rails/generators/interactor/test_unit_generator.rb +0 -15
  52. data/lib/rails/generators/templates/active_interactor.erb +0 -17
  53. data/lib/rails/generators/templates/application_context.rb +0 -4
  54. data/lib/rails/generators/templates/application_interactor.rb +0 -4
  55. data/lib/rails/generators/templates/application_organizer.rb +0 -4
  56. data/lib/rails/generators/templates/context.erb +0 -7
  57. data/lib/rails/generators/templates/context_spec.erb +0 -7
  58. data/lib/rails/generators/templates/context_test_unit.erb +0 -9
  59. data/lib/rails/generators/templates/interactor.erb +0 -15
  60. data/lib/rails/generators/templates/interactor_spec.erb +0 -7
  61. data/lib/rails/generators/templates/interactor_test_unit.erb +0 -9
  62. data/lib/rails/generators/templates/organizer.erb +0 -13
  63. data/spec/active_interactor/base_spec.rb +0 -85
  64. data/spec/active_interactor/config_spec.rb +0 -17
  65. data/spec/active_interactor/context/base_spec.rb +0 -443
  66. data/spec/active_interactor/error_spec.rb +0 -45
  67. data/spec/active_interactor/interactor/perform/options_spec.rb +0 -25
  68. data/spec/active_interactor/interactor/worker_spec.rb +0 -189
  69. data/spec/active_interactor/organizer/base_spec.rb +0 -276
  70. data/spec/active_interactor/organizer/interactor_interface_collection_spec.rb +0 -78
  71. data/spec/active_interactor/organizer/interactor_interface_spec.rb +0 -235
  72. data/spec/active_interactor/version_spec.rb +0 -119
  73. data/spec/active_interactor_spec.rb +0 -23
  74. data/spec/integration/a_basic_interactor_spec.rb +0 -154
  75. data/spec/integration/a_basic_organizer_spec.rb +0 -354
  76. data/spec/integration/a_failing_interactor_spec.rb +0 -43
  77. data/spec/integration/active_record_integration_spec.rb +0 -32
  78. data/spec/integration/an_interactor_with_after_context_validation_callbacks_spec.rb +0 -69
  79. data/spec/integration/an_interactor_with_after_perform_callbacks_spec.rb +0 -31
  80. data/spec/integration/an_interactor_with_after_rollback_callbacks_spec.rb +0 -34
  81. data/spec/integration/an_interactor_with_an_existing_context_class_spec.rb +0 -50
  82. data/spec/integration/an_interactor_with_around_perform_callbacks_spec.rb +0 -35
  83. data/spec/integration/an_interactor_with_around_rollback_callbacks_spec.rb +0 -39
  84. data/spec/integration/an_interactor_with_before_perform_callbacks_spec.rb +0 -31
  85. data/spec/integration/an_interactor_with_before_rollback_callbacks_spec.rb +0 -34
  86. data/spec/integration/an_interactor_with_deferred_after_callbacks.rb +0 -32
  87. data/spec/integration/an_interactor_with_validations_on_called_spec.rb +0 -41
  88. data/spec/integration/an_interactor_with_validations_on_calling_spec.rb +0 -37
  89. data/spec/integration/an_interactor_with_validations_spec.rb +0 -95
  90. data/spec/integration/an_organizer_containing_organizer_with_after_callbacks_deferred_spec.rb +0 -125
  91. data/spec/integration/an_organizer_performing_in_parallel_spec.rb +0 -48
  92. data/spec/integration/an_organizer_with_after_callbacks_deferred_spec.rb +0 -154
  93. data/spec/integration/an_organizer_with_after_each_callbacks_spec.rb +0 -35
  94. data/spec/integration/an_organizer_with_all_perform_callbacks.rb +0 -112
  95. data/spec/integration/an_organizer_with_around_each_callbacks_spec.rb +0 -39
  96. data/spec/integration/an_organizer_with_before_each_callbacks_spec.rb +0 -35
  97. data/spec/integration/an_organizer_with_conditionally_organized_interactors_spec.rb +0 -326
  98. data/spec/integration/an_organizer_with_failing_nested_organizer_spec.rb +0 -47
  99. data/spec/integration/an_organizer_with_options_callbacks_spec.rb +0 -64
  100. data/spec/spec_helper.rb +0 -33
  101. data/spec/support/coverage.rb +0 -50
  102. data/spec/support/helpers/factories.rb +0 -49
  103. data/spec/support/shared_examples/a_class_that_extends_active_interactor_models_example.rb +0 -81
  104. data/spec/support/shared_examples/a_class_with_interactor_callback_methods_example.rb +0 -107
  105. data/spec/support/shared_examples/a_class_with_interactor_context_methods_example.rb +0 -60
  106. data/spec/support/shared_examples/a_class_with_interactor_methods_example.rb +0 -21
  107. data/spec/support/shared_examples/a_class_with_organizer_callback_methods_example.rb +0 -42
  108. data/spec/support/spec_helpers.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47d39868b8ed69a4ae27d9cf931e42ed6e5a5daa893a7adc0c6b696bd0b4035d
4
- data.tar.gz: 9e4ae3e6102d6f6ead6d8fb4af150dc8d67124adfba1afd26420a54e57708cc7
3
+ metadata.gz: b84d76be97bd543c4583c588b6f7dae50424c640fa675b7a4fb154bc8bdb1051
4
+ data.tar.gz: c0846db96ac34ed824b79118395afea967e528f4b8eb797eb7411c156ddb5d55
5
5
  SHA512:
6
- metadata.gz: 06e1686b7e98a6ed13f136e5f847c836a4f018ba4a89c1b42e6666a4063600c22c2b6b7ad48a378462a9b0fc18f3dd28d88325bd7344c9a9647c2274804d1e01
7
- data.tar.gz: 925e3b0ab0a9562efe52d4d30d55b71b327d9169f02eed1ab1b22b9c72caa00ca5c72b1a587782f0d7c9e820465739538240666263dc9a2c999037e00e060710
6
+ metadata.gz: 2ce8f776d073318c6bfdc47e6d822febde4570aa4777eab9ff2096bac4e8162a5849e01b929f8ed4e33f04b45edeca018e9a7381e651a3ec1556b68826c2e891
7
+ data.tar.gz: 822f52d219f12aaec5f373e1eed23f70568b3dd44972eda16f6a2c27f03fb1895b3566d605602448443db263765dae6e0b7a0c2e1dfdd0f61d0392c92c064977
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [v1.2.2] - 2023-09-30
11
+
12
+ ### Fixed
13
+
14
+ - [\#366] Fixes a minor timing issue for when deferred after_perform callbacks are run.
15
+
10
16
  ## [v1.2.1] - 2022-09-26
11
17
 
12
18
  ### Fixed
@@ -21,7 +27,7 @@ and this project adheres to [Semantic Versioning].
21
27
 
22
28
  ## [v1.2.0] - 2022-09-08
23
29
 
24
- ### Added
30
+
25
31
 
26
32
  - `ActiveInteractor::Base.defer_after_callbacks_when_organized`
27
33
  - `ActiveInteractor::Organizer::Base.after_all_perform`
@@ -270,9 +276,10 @@ and this project adheres to [Semantic Versioning].
270
276
 
271
277
  <!-- versions -->
272
278
 
273
- [Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v1.2.1...HEAD
279
+ [Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v2.0.0-alpha.1.0.0...HEAD
280
+ [v1.2.2]: https://github.com/aaronmallen/activeinteractor/compare/v1.2.1...v1.2.2
274
281
  [v1.2.1]: https://github.com/aaronmallen/activeinteractor/compare/v1.2.0...v1.2.1
275
- [v1.2.0]: https://github.com/aaronmallen/activeinteractor/compare/v1.1.6...v1.2.0
282
+ [v1.2.0]: https://github.com/aaronmallen/activeinteractor/compare/v1.1.7...v1.2.0
276
283
  [v1.1.7]: https://github.com/aaronmallen/activeinteractor/compare/v1.1.6...v1.1.7
277
284
  [v1.1.6]: https://github.com/aaronmallen/activeinteractor/compare/v1.1.4...v1.1.6
278
285
  [v1.1.4]: https://github.com/aaronmallen/activeinteractor/compare/v1.1.3...v1.1.4
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Aaron Allen
3
+ Copyright (c) 2023 Aaron Allen
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,69 +1,9 @@
1
1
  # ActiveInteractor
2
2
 
3
3
  [![Version](https://img.shields.io/gem/v/activeinteractor.svg?logo=ruby)](https://rubygems.org/gems/activeinteractor)
4
- [![Build Status](https://github.com/aaronmallen/activeinteractor/workflows/Build/badge.svg)](https://github.com/aaronmallen/activeinteractor/actions)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/2f1cb318f681a1eebb27/maintainability)](https://codeclimate.com/github/aaronmallen/activeinteractor/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/2f1cb318f681a1eebb27/test_coverage)](https://codeclimate.com/github/aaronmallen/activeinteractor/test_coverage)
7
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/gems/activeinteractor)
8
- [![Inline docs](http://inch-ci.org/github/aaronmallen/activeinteractor.svg?branch=main)](http://inch-ci.org/github/aaronmallen/activeinteractor)
9
- [![License](https://img.shields.io/github/license/aaronmallen/activeinteractor.svg?maxAge=300)](https://github.com/aaronmallen/activeinteractor/blob/main/LICENSE)
4
+ [![Build](https://github.com/activeinteractor/activeinteractor/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/activeinteractor/activeinteractor/actions/workflows/build.yml)
5
+ [![License](https://img.shields.io/github/license/activeinteractor/activeinteractor.svg?maxAge=300)](https://github.com/activeinteractor/activeinteractor/blob/main/LICENSE)
10
6
 
11
- An implementation of the [command pattern] for Ruby with [ActiveModel::Validations] inspired by the
12
- [interactor][collective_idea_interactors] gem. Rich support for attributes, callbacks, and validations,
13
- and thread safe performance methods.
7
+ ## DISCLAIMER
14
8
 
15
- Reduce controller bloat with procedural service objects. Checkout this [Medium article] for a crash
16
- course on how to use ActiveInteractors. Read the [wiki] for detailed usage information.
17
-
18
- ## Features
19
-
20
- * [Context validation][wiki_context_validation]
21
- * [Callbacks][wiki_callbacks]
22
- * Thread safe performance calls
23
- * Organize multiple interactors [conditionally][wiki_organizers_conditionally] or in [parallel][wiki_organizers_parallel]
24
-
25
- ## Documentation
26
-
27
- Be sure to read the [wiki] for detailed information on how to use ActiveInteractor.
28
-
29
- For technical documentation please see the gem's [ruby docs].
30
-
31
- ## Install
32
-
33
- Add this line to your application's Gemfile:
34
-
35
- ```ruby
36
- gem 'activeinteractor', require: 'active_interactor'
37
- ```
38
-
39
- Or install it yourself as:
40
-
41
- ```sh
42
- gem install activeinteractor
43
- ```
44
-
45
- ## Contributing
46
-
47
- Read our guidelines for [Contributing](CONTRIBUTING.md).
48
-
49
- ## Acknowledgements
50
-
51
- ActiveInteractor is made possible by wonderful [humans].
52
-
53
- ## License
54
-
55
- The gem is available as open source under the terms of the [MIT License][mit_license].
56
-
57
- [ActiveModel::Validations]: https://api.rubyonrails.org/classes/ActiveModel/Validations.html
58
- [business_logic_wikipedia]: https://en.wikipedia.org/wiki/Business_logic
59
- [collective_idea_interactors]: https://github.com/collectiveidea/interactor
60
- [command pattern]: https://en.wikipedia.org/wiki/Command_pattern
61
- [humans]: https://github.com/aaronmallen/activeinteractor/tree/main/HUMANS.md
62
- [Medium article]: https://medium.com/@aaronmallen/activeinteractor-8557c0dc78db
63
- [mit_license]: https://opensource.org/licenses/MIT
64
- [ruby docs]: https://www.rubydoc.info/gems/activeinteractor
65
- [wiki]: https://github.com/aaronmallen/activeinteractor/wiki
66
- [wiki_callbacks]: https://github.com/aaronmallen/activeinteractor/wiki/Callbacks
67
- [wiki_context_validation]: https://github.com/aaronmallen/activeinteractor/wiki/Context#validating-the-context
68
- [wiki_organizers_conditionally]: https://github.com/aaronmallen/activeinteractor/wiki/Interactors#organizing-interactors-conditionally
69
- [wiki_organizers_parallel]: https://github.com/aaronmallen/activeinteractor/wiki/Interactors#running-interactors-in-parallel
9
+ This project is a work in progress. Go [here](https://github.com/aaronmallen/activeinteractor) for information on the current version of ActiveInteractor.
@@ -1,35 +1,83 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveInteractor
4
- # The base class all {Base interactors} should inherit from.
5
- #
6
- # When {Base} is loaded by your application an
7
- # {https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html ActiveSupport load hook} is called
8
- # with `:active_interactor` and {Base}.
9
- #
10
- # @author Aaron Allen <hello@aaronmallen.me>
11
- # @since 0.1.0
12
- #
13
- # @example a basic {Base interactor}
14
- # class MyInteractor < ActiveInteractor::Base
15
- # def perform
16
- # # TODO: implement the perform method
17
- # end
18
- #
19
- # def rollback
20
- # # TODO: implement the rollback method
21
- # end
22
- # end
23
4
  class Base
24
- extend ActiveInteractor::Interactor::Callbacks::ClassMethods
25
- extend ActiveInteractor::Interactor::Context::ClassMethods
26
- extend ActiveInteractor::Interactor::Perform::ClassMethods
27
-
28
- include ActiveSupport::Callbacks
29
- include ActiveInteractor::Interactor::Callbacks
30
- include ActiveInteractor::Interactor::Context
31
- include ActiveInteractor::Interactor::Perform
32
- end
5
+ class << self
6
+ def argument(name, type, description = nil, **options)
7
+ attributes[:arguments][name.to_sym] = { name: name, type: type, description: description }.merge(options)
8
+ end
9
+
10
+ def perform(input_context = {})
11
+ new(input_context).send(:exec_perform!)
12
+ rescue Error => e
13
+ e.result
14
+ rescue StandardError => e
15
+ Result.failure(errors: e.message)
16
+ end
17
+
18
+ def returns(name, type, description = nil, **options)
19
+ attributes[:fields][name.to_sym] = { name: name, type: type, description: description }.merge(options)
20
+ end
21
+
22
+ private
23
+
24
+ def attributes
25
+ @attributes ||= { arguments: {}, fields: {} }
26
+ end
27
+ end
28
+
29
+ def initialize(input = {})
30
+ @input = input.freeze
31
+ @context = parse_input!
32
+ end
33
+
34
+ def perform; end
35
+ def rollback; end
36
+
37
+ protected
38
+
39
+ attr_accessor :context
40
+
41
+ def exec_perform!
42
+ perform
43
+ Result.success(data: parse_output!)
44
+ end
33
45
 
34
- ActiveSupport.run_load_hooks(:active_interactor, Base)
46
+ def fail!(errors = {})
47
+ rollback
48
+ raise Error, Result.failure(data: context, errors: errors)
49
+ end
50
+
51
+ def parse_input!
52
+ errors = {}
53
+ context = self.class.send(:attributes)[:arguments].each_with_object({}) do |(name, options), hash|
54
+ errors = validate_attribute_value(@input[name], name, options, errors)
55
+ hash[name] = @input[name] || options[:default]
56
+ end
57
+
58
+ raise Error, Result.failure(errors: errors, status: Result::STATUS[:failed_on_input]) unless errors.empty?
59
+
60
+ context
61
+ end
62
+
63
+ def parse_output!
64
+ errors = {}
65
+ context = self.class.send(:attributes)[:fields].each_with_object({}) do |(name, options), hash|
66
+ errors = validate_attribute_value(self.context[name], name, options, errors)
67
+ hash[name] = self.context[name] || options[:default]
68
+ end
69
+
70
+ raise Error, Result.failure(errors: errors, status: Result::STATUS[:failed_on_output]) unless errors.empty?
71
+
72
+ context
73
+ end
74
+
75
+ def validate_attribute_value(value, attribute_name, attribute_options, errors)
76
+ return errors unless value.blank? && attribute_options[:required] && !attribute_options[:default]
77
+
78
+ errors[attribute_name] ||= []
79
+ errors[attribute_name] << :blank
80
+ errors
81
+ end
82
+ end
35
83
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveInteractor
4
+ class Error < StandardError
5
+ attr_reader :result
6
+
7
+ def initialize(result, message = nil)
8
+ @result = result
9
+ super(message)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveInteractor
4
+ class Result
5
+ extend ActiveModel::Naming
6
+
7
+ STATUS = {
8
+ success: 0,
9
+ failed_at_input: 1,
10
+ failed_at_runtime: 2,
11
+ failed_at_output: 3
12
+ }.freeze
13
+
14
+ attr_reader :data, :errors
15
+
16
+ class << self
17
+ def success(data: {})
18
+ new(status: STATUS[:success], data: data)
19
+ end
20
+
21
+ def failure(data: {}, errors: {}, status: STATUS[:failed_at_runtime])
22
+ result = new(status: status, data: data)
23
+ parse_errors(errors).each_pair do |attribute, messages|
24
+ Array.wrap(messages).each { |message| result.errors.add(attribute, message) }
25
+ end
26
+ result
27
+ end
28
+
29
+ def human_attribute_name(attribute, _options = {})
30
+ attribute.respond_to?(:to_s) ? attribute.to_s.humanize : attribute
31
+ end
32
+
33
+ def lookup_ancestors
34
+ [self]
35
+ end
36
+
37
+ private
38
+
39
+ def parse_errors(errors)
40
+ case errors
41
+ when String
42
+ { generic: [errors] }
43
+ when ActiveModel::Errors
44
+ errors.as_json
45
+ else
46
+ errors
47
+ end
48
+ end
49
+ end
50
+
51
+ private_class_method :new
52
+
53
+ def initialize(status:, data: {})
54
+ @status = status
55
+ @data = data
56
+ @errors = ActiveModel::Errors.new(self)
57
+ end
58
+
59
+ def failure?
60
+ !success?
61
+ end
62
+ alias failed? failure?
63
+
64
+ def read_attribute_for_validation(attribute_name)
65
+ data[attribute_name]
66
+ end
67
+
68
+ def success?
69
+ @status == STATUS[:success]
70
+ end
71
+ alias successful? success?
72
+ end
73
+ end
@@ -1,111 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_model'
4
- require 'active_support/callbacks'
5
- require 'active_support/core_ext/array/extract_options'
6
- require 'active_support/core_ext/class/attribute'
7
- require 'active_support/core_ext/string/inflections'
8
- require 'active_support/dependencies/autoload'
9
- require 'logger'
10
- require 'ostruct'
4
+ require 'active_support'
11
5
 
12
- require 'active_interactor/configurable'
13
- require 'active_interactor/config'
14
- require 'active_interactor/version'
6
+ require_relative 'active_interactor/errors'
15
7
 
16
- # An {Base interactor} is a simple, single-purpose service object. {Base Interactors} can be used to reduce the
17
- # responsibility of your controllers, workers, and models and encapsulate your application's
18
- # {https://en.wikipedia.org/wiki/Business_logic business logic}. Each {Base interactor} represents one thing that your
19
- # application does.
20
- #
21
- # Each {Base interactor} has it's own immutable {Context::Base context} which contains everything the
22
- # {Base interactor} needs to do its work. When an {Base interactor} does its single purpose, it affects its given
23
- # {Context::Base context}.
24
- #
25
- # @see https://medium.com/@aaronmallen/activeinteractor-8557c0dc78db Basic Usage
26
- # @see https://github.com/aaronmallen/activeinteractor/wiki Advanced Usage
27
- # @see https://github.com/aaronmallen/activeinteractor Source Code
28
- # @see https://github.com/aaronmallen/activeinteractor/issues Issues
29
- #
30
- # ## License
31
- #
32
- # Copyright (c) 2019 Aaron Allen
33
- #
34
- # Permission is hereby granted, free of charge, to any person obtaining a copy
35
- # of this software and associated documentation files (the "Software"), to deal
36
- # in the Software without restriction, including without limitation the rights
37
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38
- # copies of the Software, and to permit persons to whom the Software is
39
- # furnished to do so, subject to the following conditions:
40
- #
41
- # The above copyright notice and this permission notice shall be included in
42
- # all copies or substantial portions of the Software.
43
- #
44
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
50
- # THE SOFTWARE.
51
8
  module ActiveInteractor
52
9
  extend ActiveSupport::Autoload
53
10
 
54
11
  autoload :Base
55
-
56
- # {Context::Base Context} classes and modules
57
- #
58
- # @see https://github.com/aaronmallen/activeinteractor/wiki/Context Context
59
- #
60
- # @author Aaron Allen <hello@aaronmallen.me>
61
- # @since 0.1.0
62
- module Context
63
- extend ActiveSupport::Autoload
64
-
65
- autoload :Attributes
66
- autoload :Base
67
- autoload :Errors
68
- autoload :Loader
69
- autoload :Status
70
- end
71
-
72
- # {Base Interactor} classes and modules
73
- #
74
- # @see https://github.com/aaronmallen/activeinteractor/wiki/Interactors Interactors
75
- #
76
- # @author Aaron Allen <hello@aaronmallen.me>
77
- # @since 0.1.0
78
- module Interactor
79
- extend ActiveSupport::Autoload
80
-
81
- autoload :Callbacks
82
- autoload :Context
83
- autoload :Perform
84
- autoload :Worker
85
- end
86
-
87
- autoload :Models
88
-
89
- # {Organizer::Base Organizer} classes and modules
90
- #
91
- # @see https://github.com/aaronmallen/activeinteractor/wiki/Interactors#organizers Organizers
92
- #
93
- # @author Aaron Allen <hello@aaronmallen.me>
94
- # @since 0.1.0
95
- module Organizer
96
- extend ActiveSupport::Autoload
97
-
98
- autoload :Base
99
- autoload :Callbacks
100
- autoload :InteractorInterface
101
- autoload :InteractorInterfaceCollection
102
- autoload :Organize
103
- autoload :Perform
104
- end
105
-
106
- eager_autoload do
107
- autoload :Error
108
- end
12
+ autoload :Result
109
13
  end
110
-
111
- require 'active_interactor/rails' if defined?(::Rails)
@@ -0,0 +1,3 @@
1
+ module Activeinteractor
2
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
3
+ end