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?
44 45 46 |
# File 'lib/use_case_pattern/base.rb', line 44 def failure? errors.any? end |
#perform ⇒ Object
Implement all the steps required to complete this use case
26 27 28 |
# File 'lib/use_case_pattern/base.rb', line 26 def perform raise NotImplementedError end |
#perform! ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/use_case_pattern/base.rb', line 30 def perform! if invalid? raise(ValidationError.new(self)) end perform end |
#success? ⇒ Boolean
Did the use case performed its task without errors?
39 40 41 |
# File 'lib/use_case_pattern/base.rb', line 39 def success? errors.none? end |