lib/core/core.rb
# Any Lorj process module will need to declare itself to Lorj
# with this function.
#
# * *args* :
#   - +process_name+: name of the process declared to Lorj. This name must be
#     unique. Otherwise the declaration won't happen.
#
#   - +path+        : Path where process dir structure are located.
#     at least, it expects to find the process/<name>.rb
#     Each controllers found will be added as well.
#     It must be controllers/<controller_name>/<controller_name>.rb
#     You can change 'controllers' by any name, with :controllers_dir
#
#   - +properties+   : List of possible options:
#     - :controllers_dir : Name of the controllers directory.
#       By default 'controllers'
#     - :lib_name : Required. name of the gem library declaring the process.
#       Used by lorj to import an account data and validate it, thanks to the
#       process data structure.
#
#  The process will be added in Lorj.processes Hash
#
Any Lorj process module will need to declare itself to Lorj
with this function.

*args* :
+process_name+: name of the process declared to Lorj. This name must be
unique. Otherwise the declaration won't happen.

+path+        : Path where process dir structure are located.
at least, it expects to find the process/.rb
Each controllers found will be added as well.
It must be controllers//.rb
You can change 'controllers' by any name, with :controllers_dir

+properties+   : List of possible options:
:controllers_dir : Name of the controllers directory.
By default 'controllers'
:lib_name : Required. name of the gem library declaring the process.
Used by lorj to import an account data and validate it, thanks to the
process data structure.

The process will be added in Lorj.processes Hash
Any Lorj process module will need to declare itself to Lorj with this function . * args * : + process_name + : name of the process declared to Lorj . This name must be unique . Otherwise the declaration won ' t happen . + path + : Path where process dir structure are located . at least it expects to find the process / . rb Each controllers found will be added as well . It must be controllers // . rb You can change ' controllers ' by any name with : controllers_dir + properties + : List of possible options : : controllers_dir : Name of the controllers directory . By default ' controllers ' : lib_name : Required . name of the gem library declaring the process . Used by lorj to import an account data and validate it thanks to the process data structure . The process will be added in Lorj . processes Hash
def declare_process(process_name, path, properties = {})
    unless properties.is_a?(Hash) && properties[:lib_name].is_a?(String)
      puts("Lorj: process module error: '#{__method__}"\
           "('#{process_name}', '#{path}', #{properties})' requires :lib_name"\
           "\nat line #{caller[0]}")
      return nil
    end
    process_data = Lorj::ProcessResource.new(process_name, path, properties)
    if process_data.nil?
      puts("Lorj: process module error: '#{process_name}' fails to be "\
           "declared:\n"\
           "process_name: '#{process_name}'\n"\
           "path        : '#{path}'\n"\
           "properties  : #{properties.to_yaml}")
      return nil
    end
    @processes = {} if @processes.nil?
    if process_data.process.nil?
      puts("Lorj: process module error: process failure:\n"\
           "process_name: '#{process_name}'\n"\
           "path        : '#{path}'\n"\
           "properties  : #{properties.to_yaml}")
      return nil
    end
    process_name = process_data.name
    @processes[process_name] = process_data unless @processes.key?(process_name)
    process_data
  end
def declare_process ( process_name , path , properties = { } ) unless properties . is_a? ( Hash ) && properties [ :lib_name ] . is_a? ( String ) puts ( "Lorj: process module error: '#{__method__}" "('#{process_name}', '#{path}', #{properties})' requires :lib_name" "\nat line #{caller[0]}" ) return nil end process_data = Lorj :: ProcessResource . new ( process_name , path , properties ) if process_data . nil? puts ( "Lorj: process module error: '#{process_name}' fails to be " "declared:\n" "process_name: '#{process_name}'\n" "path        : '#{path}'\n" "properties  : #{properties.to_yaml}" ) return nil end @processes = { } if @processes . nil? if process_data . process . nil? puts ( "Lorj: process module error: process failure:\n" "process_name: '#{process_name}'\n" "path        : '#{path}'\n" "properties  : #{properties.to_yaml}" ) return nil end process_name = process_data . name @processes [ process_name ] = process_data unless @processes . key? ( process_name ) process_data end
Any Lorj process module will need to declare itself to Lorj
with this function.
Any Lorj process module will need to declare itself to Lorj with this function .
process_name
<not_specific>
path
<not_specific>
properties
<not_specific>