Module: ActForm::Runnable
Instance Method Summary collapse
- #failure? ⇒ Boolean
- #has_errors? ⇒ Boolean
- #perform ⇒ Object
- #run ⇒ Object
- #run! ⇒ Object
- #success? ⇒ Boolean
Instance Method Details
#failure? ⇒ Boolean
50 51 52 |
# File 'lib/act_form/runnable.rb', line 50 def failure? !success? end |
#has_errors? ⇒ Boolean
22 23 24 |
# File 'lib/act_form/runnable.rb', line 22 def has_errors? !errors.empty? end |
#perform ⇒ Object
44 |
# File 'lib/act_form/runnable.rb', line 44 def perform; end |
#run ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/act_form/runnable.rb', line 26 def run if valid? @result = perform @performed = true end self end |
#run! ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/act_form/runnable.rb', line 34 def run! if valid? @result = perform @performed = true result else raise RunError, 'Verification failed' end end |
#success? ⇒ Boolean
46 47 48 |
# File 'lib/act_form/runnable.rb', line 46 def success? !has_errors? && !!@performed end |