Module: UseCasePattern::Base
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/use_case_pattern/base.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#failure? ⇒ Boolean
Did the use case have any errors?.
-
#perform ⇒ Object
Implement all the steps required to complete this use case.
- #perform! ⇒ Object
-
#success? ⇒ Boolean
Did the use case performed its task without errors?.
Instance Method Details
#failure? ⇒ Boolean
Did the use case have any errors?
57 58 59 |
# File 'lib/use_case_pattern/base.rb', line 57 def failure? errors.any? end |
#perform ⇒ Object
Implement all the steps required to complete this use case
39 40 41 |
# File 'lib/use_case_pattern/base.rb', line 39 def perform raise NotImplementedError end |
#perform! ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/use_case_pattern/base.rb', line 43 def perform! if invalid? raise(ValidationError.new(self)) end perform end |
#success? ⇒ Boolean
Did the use case performed its task without errors?
52 53 54 |
# File 'lib/use_case_pattern/base.rb', line 52 def success? errors.none? end |