Skip to content
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

`ItemView#parent` doesn't return nil if there is no parent #600

ddfreyne opened this Issue May 26, 2015 · 2 comments


None yet
2 participants
Copy link

ddfreyne commented May 26, 2015

ItemView#parent doesn't return nil if there is no parent. It returns an ItemView with @item=nil.

Reported by @cdlm.


This comment has been minimized.

Copy link

TheLonelyGhost commented May 26, 2015

Shouldn't this follow the null object pattern though? Returning nil isn't as telling as something like EmptyItemView, especially when debugging NoMethodError on NilClass...


This comment has been minimized.

Copy link
Member Author

ddfreyne commented May 27, 2015

I don’t think it makes sense to use the null object pattern here. None of the methods (#[], #identifier, #compiled_content, …) make sense for a NullItemView and they’d probably just raise an error, at which point having a nil instead of a NullItemView is more obvious and less work.

cdlm added a commit to cdlm/website-nanoc that referenced this issue May 29, 2015

@ddfreyne ddfreyne modified the milestone: 4.0.0 Jun 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.