Module: Og::TreeTraversal

Defined in:
lib/og/mixin/tree.rb

Overview

A useful encapsulation of the nested intervals pattern for hierarchical SQL queries. Slightly adapted from the original article (www.dbazine.com/tropashko4.shtml)

Class Method Summary collapse

Class Method Details

.child(sum, n) ⇒ Object



19
20
21
22
23
# File 'lib/og/mixin/tree.rb', line 19

def self.child(sum, n)
	power = 2 ** n

	return sum * power
end