summaryrefslogtreecommitdiff
path: root/lib/action_file_executor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_file_executor.rb')
-rw-r--r--lib/action_file_executor.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/action_file_executor.rb b/lib/action_file_executor.rb
index 15d4f63..1cd3a94 100644
--- a/lib/action_file_executor.rb
+++ b/lib/action_file_executor.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require_relative 'family_tree_manager'
+
class ActionFileExecutor
def initialize(file_path)
@file_path = file_path
@@ -10,7 +12,14 @@ class ActionFileExecutor
File.open(@file_path, 'r') do |file|
file.each_line do |line|
action, *params = line.split(' ')
- puts "Executing action: #{action} with params: #{params.join(', ')}"
+ case action
+ when 'ADD_CHILD'
+ FamilyTreeManager.instance.add_child(*params)
+ when 'GET_RELATIONSHIP'
+ FamilyTreeManager.instance.query_hierarchy(*params)
+ else
+ puts "Ignoring unsupported action: [#{action}]"
+ end
end
end
end