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

Closed
denisdefreyne opened this issue May 26, 2015 · 2 comments · Fixed by #602
Closed

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

denisdefreyne opened this issue May 26, 2015 · 2 comments · Fixed by #602
Milestone

Comments

@denisdefreyne
Copy link
Member

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

Reported by @cdlm.

@TheLonelyGhost
Copy link
Contributor

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...

@denisdefreyne
Copy link
Member Author

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
@denisdefreyne denisdefreyne 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants