Module: ActForm::Runnable

Extended by:
ActiveSupport::Concern
Included in:
Command
Defined in:
lib/act_form/runnable.rb

Instance Method Summary collapse

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)

50
51
52
# File 'lib/act_form/runnable.rb', line 50

def failure?
  !success?
end

#has_errors?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/act_form/runnable.rb', line 22

def has_errors?
  !errors.empty?
end

#performObject


44
# File 'lib/act_form/runnable.rb', line 44

def perform; end

#runObject


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

Returns:

  • (Boolean)

46
47
48
# File 'lib/act_form/runnable.rb', line 46

def success?
  !has_errors? && !!@performed
end