module SDL::Base::ServiceCompendium::ServiceLoadTransaction

A transaction for loading vocabulary definition

Public Instance Methods

load_service_from_path(path_or_filename, ignore_errors = false) click to toggle source

Loads a service, either from a file or from a path recursively.

Service definition files are expected to end with .service.rb @param path_or_filename Either a filename or a path @param ignore_errors Ignore errors when loading service

# File lib/sdl/base/service_compendium/service_load_transaction.rb, line 12
def load_service_from_path(path_or_filename, ignore_errors = false)
  to_files_array(path_or_filename, '.service.rb').each do |filename|
    service_name = filename.match(%r[.+/(.+).service.rb])[1]

    begin
      load_service_from_string File.read(filename), service_name, filename
    rescue Exception => e
      raise e unless ignore_errors
    end
  end
end