class SimpleServiceProvider::Base
Public Instance Methods
run()
click to toggle source
# File lib/simple_service_provider/base.rb, line 19 def run raise NotImplementedError end
run!()
click to toggle source
# File lib/simple_service_provider/base.rb, line 29 def run! run end
work(options = {})
click to toggle source
# 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 = {})
click to toggle source
# File lib/simple_service_provider/base.rb, line 23 def work!(options = {}) run_callbacks :work do perform_validations(options) { run! } end end
Private Instance Methods
perform_validations(options = {}) { || ... }
click to toggle source
# File lib/simple_service_provider/base.rb, line 35 def perform_validations(options = {}) options.reverse_merge!(:validate => true) if options[:validate] && valid? yield if block_given? else raise SimpleServiceProvider::RecordInvalid.new(self) end end