Module: DataMapper::Is::Tree::ClassMethods

Defined in:
lib/dm-is-tree/is/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tree_optionsObject (readonly)

Returns the value of attribute tree_options.



96
97
98
# File 'lib/dm-is-tree/is/tree.rb', line 96

def tree_options
  @tree_options
end

Instance Method Details

#first_rootObject



104
105
106
107
108
# File 'lib/dm-is-tree/is/tree.rb', line 104

def first_root
  options = { tree_options[:child_key] => nil }
  options = { :order => Array(tree_options[:order]) }.merge(options) if tree_options[:order]
  first(options)
end

#rootsObject



98
99
100
101
102
# File 'lib/dm-is-tree/is/tree.rb', line 98

def roots
  options = { tree_options[:child_key] => nil }
  options = { :order => Array(tree_options[:order]) }.merge(options) if tree_options[:order]
  all(options)
end