Module: ActForm::Runnable
Overview
Define runnable behaivor for form object.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#has_errors? ⇒ Boolean
rubocop:disable Naming/PredicateName.
- #perform ⇒ Object
- #run ⇒ Object
- #run! ⇒ Object
- #success? ⇒ Boolean
Instance Method Details
#failure? ⇒ Boolean
58 59 60 |
# File 'lib/act_form/runnable.rb', line 58 def failure? !success? end |
#has_errors? ⇒ Boolean
rubocop:disable Naming/PredicateName
30 31 32 |
# File 'lib/act_form/runnable.rb', line 30 def has_errors? # rubocop:disable Naming/PredicateName !errors.empty? end |
#perform ⇒ Object
52 |
# File 'lib/act_form/runnable.rb', line 52 def perform; end |
#run ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/act_form/runnable.rb', line 34 def run if valid? @result = perform @performed = true end self end |
#run! ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/act_form/runnable.rb', line 42 def run! if valid? # rubocop:disable Style/GuardClause @result = perform @performed = true result else raise RunError, 'Verification failed' end end |
#success? ⇒ Boolean
54 55 56 |
# File 'lib/act_form/runnable.rb', line 54 def success? !has_errors? && !!@performed end |