example/students_5/students.rb in lorj-1.0.9 vs example/students_5/students.rb in lorj-1.0.10
- old
+ new
@@ -48,15 +48,16 @@
# debug settings.
# PrcLib.level = Logger::DEBUG # Printed out to your console.
# PrcLib.core_level = 5 # framework debug levels.
# Initialize the framework
-processes = [File.join(app_path, 'process', 'students.rb')]
-controller = File.join(app_path, 'controller', 'yaml_students.rb')
-
+processes = []
+processes << { :process_path => File.join(app_path, 'process', 'students.rb'),
+ :controller_path => File.join(app_path, 'controller',
+ 'yaml_students.rb') }
# ~ student_core = Lorj::Core.new( config, processes, :mock)
-student_core = Lorj::Core.new(config, processes, controller)
+student_core = Lorj::Core.new(config, processes)
student_core.create(:connection, :connection_string => '/tmp/students.yaml')
puts ANSI.bold('Create 1st student:')
@@ -77,32 +78,32 @@
student_core.create(:student,
:student_name => 'Anthony Hopkins',
:first_name => 'Anthony',
:last_name => 'Hopkins',
:course => 'Art Drama'
-)
+ )
# config[:student_name] = "Anthony Hopkins"
# config[:course] = "Art Drama"
# student_core.Create(:student)
puts ANSI.bold('Create 3rd student:')
student_core.create(:student,
:student_name => 'Marilyn Monroe',
:first_name => 'Marilyn',
:last_name => 'Monroe',
:course => 'Art Drama'
-)
+ )
# replaced the following :
# config[:student_name] = "Anthony Hopkins"
# student_core.Create(:student)
puts ANSI.bold('Create mistake')
student = student_core.create(:student,
:student_name => 'Anthony Mistake',
:first_name => 'Anthony',
:last_name => 'Mistake',
:course => 'what ever you want!!!'
-)
+ )
puts format("Student created '%s'", student[:attrs])
# Because the last student was the mistake one, we can directly delete it.
# Usually, we use get instead.