Skip to content

Commit

Permalink
Ancestors method
Browse files Browse the repository at this point in the history
  • Loading branch information
nbudin committed Sep 26, 2011
1 parent 8c0ea17 commit 96015b2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ntee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def parent=(parent)
@parent = parent
end

def ancestors
if parent
[parent] + parent.ancestors
else
[]
end
end

def add_subcategory!(subcategory)
subcategories[subcategory.code.to_s] = subcategory
subcategory.parent = self
Expand Down

0 comments on commit 96015b2

Please sign in to comment.