-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/build tree #1
Conversation
Add functionality for building a tree representation of the nested line nubmers.
Add method for .has_children?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I have a line representation like this:
%NestedLines{
lines: [
[1],
[0, 1],
[0, 1],
[0, 1],
[0, 1],
[0, 1],
[1],
[0, 1],
[0, 1],
[0, 1],
[0, 1],
[0, 1],
[0, 0, 1]
]
}
The build_tree
output gives me
[
%{
line: "1",
children: [
%{line: "1.1", children: []},
%{line: "1.2", children: []},
%{line: "1.3", children: []},
%{line: "1.4", children: []},
%{line: "1.5", children: []}
]
},
%{
line: "2",
children: [
%{line: "2.1", children: [%{line: "2.5.1", children: []}]},
%{line: "2.2", children: []},
%{line: "2.3", children: []},
%{line: "2.4", children: []},
%{line: "2.5", children: []}
]
}
]
Should that child line be under this map instead? %{line: "2.5", children: []}
Update logic for adding child line to siblings: Push onto the front of the list instead of appending to the end. Check the proper line property on the latest tree line when looking for the parent line. Update build_tree to reverse all children, needed with change to sort of child lines. Add tests.
Adjusted logic for adding lines to the proper parent and added more tests. |
Use indentation for the first line
Update usage documentation to include a blurb about build_tree. Update documentation to use line numbers instead of internal lines representation
Change .build_tree to .tree
Looks awesome! I like that the tree representation is explicit 👍. 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it! 🚀 🌕
Add
build_tree
andhas_children?
to NestedLines