lib/og/mixin/hierarchical.rb in og-0.19.0 vs lib/og/mixin/hierarchical.rb in og-0.20.0

- old
+ new

@@ -57,10 +57,18 @@ end def child? (@#{parent} && @#{parent} != 0) && (@#{left} > 1) && (@#{right} > @#{left}) end + + def parent + if root? + nil + else + #{base}[@#{parent}] + end + end def #{children}_count return (@#{right} - @#{left} - 1)/2 end @@ -135,5 +143,6 @@ end end # * George Moschovitis <gm@navel.gr> +# * Aleksi Niemela <Aleksi.Niemela@cs.helsinki.fi>