Class: SimpleServiceProvider::Base

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Callbacks
Includes:
ActiveModel::Validations, Virtus
Defined in:
lib/simple_service_provider/base.rb

Instance Method Summary collapse

Instance Method Details

#runObject

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/simple_service_provider/base.rb', line 19

def run
  raise NotImplementedError
end

#run!Object



29
30
31
# File 'lib/simple_service_provider/base.rb', line 29

def run!
  run
end

#work(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/simple_service_provider/base.rb', line 9

def work(options = {})
  run_callbacks :work do
    begin
      perform_validations(options) { run }
    rescue SimpleServiceProvider::RecordInvalid => ex
      $stdout.puts "The consultant could not perform the work because the following errors : " + ex.message
    end
  end
end

#work!(options = {}) ⇒ Object



23
24
25
26
27
# File 'lib/simple_service_provider/base.rb', line 23

def work!(options = {})
  run_callbacks :work do
    perform_validations(options) { run! }
  end
end