Skip to content

Commit 2f3950b

Browse files
author
Ahmed Ammar
committed
split relation_arrow into more methods
1 parent e9bfc85 commit 2f3950b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

lib/rails_erd/diagram/mermaid.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,25 @@ def filename
5454
end
5555

5656
def relation_arrow(relationship)
57-
arrow_body = relationship.indirect? ? ".." : "--"
58-
arrow_head = relationship.to_many? ? ">" : ""
59-
arrow_tail = relationship.many_to? ? "<" : ""
57+
arrow_body = arrow_body relationship
58+
arrow_head = arrow_head relationship
59+
arrow_tail = arrow_tail relationship
6060

6161
"#{arrow_tail}#{arrow_body}#{arrow_head}"
6262
end
6363

64+
def arrow_body(relationship)
65+
relationship.indirect? ? ".." : "--"
66+
end
67+
68+
def arrow_head(relationship)
69+
relationship.to_many? ? ">" : ""
70+
end
71+
72+
def arrow_tail(relationship)
73+
relationship.many_to? ? "<" : ""
74+
end
75+
6476
end
6577
end
6678
end

0 commit comments

Comments
 (0)