summaryrefslogtreecommitdiff
path: root/lib/relationship_manager.rb
diff options
context:
space:
mode:
authorSzymon Szukalski <szymon@skas.io>2024-10-25 10:00:36 +1100
committerSzymon Szukalski <szymon@skas.io>2024-10-25 10:00:36 +1100
commit05fda6c29f0fe4742b7ea6b237ea98f737b68b8b (patch)
tree3fca7845fc80f0d93370d2bdadb647f3f9c65d25 /lib/relationship_manager.rb
parentd41d881cf8af8cb8b6cb89b87a351585ee46063c (diff)
Document code with YARD
Diffstat (limited to 'lib/relationship_manager.rb')
-rw-r--r--lib/relationship_manager.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/relationship_manager.rb b/lib/relationship_manager.rb
index 08d87e1..30dfd94 100644
--- a/lib/relationship_manager.rb
+++ b/lib/relationship_manager.rb
@@ -2,9 +2,18 @@
require 'singleton'
+# RelationshipManager class to manage relationships between people.
+# This class follows the Singleton pattern to ensure there is only one instance
+# of the relationship manager throughout the application.
class RelationshipManager
include Singleton
+ # Links two people as spouses.
+ #
+ # @param person1 [Person] The first person to link.
+ # @param person2 [Person] The second person to link.
+ # @raise [RuntimeError] if either person is already linked to someone else.
+ # @return [void]
def link_spouses(person1, person2)
# Check if either person is already linked to someone else
if person1.spouse != NilPerson.new && person1.spouse != person2