module AddedHierarchyLevel
Public Instance Methods
added_calc(result_set,args,depth,type)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 51 def added_calc(result_set,args,depth,type) initial = added_linear_load(result_set,args) method_detection(result_set,depth,type,initial,@@result_group) return @@linear end
added_hchildren(result_set,args)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 19 def added_hchildren(result_set,args) children_group(result_set,args) self.hchildren_structure(result_set,@@result_group) end
added_hchildren_ids(result_set,args)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 24 def added_hchildren_ids(result_set,args) children_group(result_set,args) self.hchildren_structure_ids(result_set,@@result_group) end
added_hierarchy(result_set,args,depth = 0)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 6 def added_hierarchy(result_set,args,depth = 0) added_hierarchy_calc(result_set,args,depth,'tree_structure') end
added_hierarchy_calc(result_set,args,depth,type)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 14 def added_hierarchy_calc(result_set,args,depth,type) initial = initial_load(result_set,args) method_detection(result_set,depth,type,self,@@result_group) end
added_hierarchy_level(result_set,args,depth = 0)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 10 def added_hierarchy_level(result_set,args,depth = 0) added_hierarchy_calc(result_set,args,depth,'tree_structure_level') end
added_linear(result_set,args,depth = 0)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 43 def added_linear(result_set,args,depth = 0) added_calc(result_set,args,depth,'linear_structure') end
added_linear_level(result_set,args,depth = 0)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 47 def added_linear_level(result_set,args,depth = 0) added_calc(result_set,args,depth,'linear_structure_level') end
added_linear_load(result_set,args)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 61 def added_linear_load(result_set,args) @@linear = initialise_array() initial_load(result_set,args) end
initialise_array()
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 66 def initialise_array() [] end
linear(result_set,depth = 0)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 33 def linear(result_set,depth = 0) linear_calc(result_set,depth,'linear_structure') end
linear_calc(result_set,depth,type)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 37 def linear_calc(result_set,depth,type) result_group = linear_load(result_set) method_detection(result_set,depth,type,self,result_group) return @@linear end
linear_level(result_set,depth = 0)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 29 def linear_level(result_set,depth = 0) linear_calc(result_set,depth,'linear_structure_level') end
linear_method_detection(result_set,result_group,depth,increment,type)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 106 def linear_method_detection(result_set,result_group,depth,increment,type) result_group[self.id].map{|x| x.send(type,result_set,result_group,depth,increment + 1)} unless presence_check(result_group[self.id]) end
linear_structure(result_set,result_group)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 94 def linear_structure(result_set,result_group) @@linear << self result_group[self.id].map{|x| x.linear_structure(result_set,result_group)} unless presence_check(result_group[self.id]) end
linear_structure_depth(result_set,result_group,depth,increment = 1)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 99 def linear_structure_depth(result_set,result_group,depth,increment = 1) unless compare(increment,depth) @@linear << self linear_method_detection(result_set,result_group,depth,increment,'linear_structure_depth') end end
linear_structure_level(result_set,result_group,increment = 1)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 82 def linear_structure_level(result_set,result_group,increment = 1) @@linear << self.attributes.merge(:level => increment) result_group[self.id].map{|x| x.linear_structure_level(result_set,result_group,increment+1)} unless presence_check(result_group[self.id]) end
linear_structure_level_depth(result_set,result_group,depth,increment = 1)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 87 def linear_structure_level_depth(result_set,result_group,depth,increment = 1) unless compare(increment,depth) @@linear << self.attributes.merge({:level => increment}) linear_method_detection(result_set,result_group,depth,increment,'linear_structure_level_depth') end end
method_detection(result_set,depth,type,initial,result_group)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 57 def method_detection(result_set,depth,type,initial,result_group) level_check(depth) ? initial.send(type,result_set,result_group) : initial.send(type+'_depth',result_set,@@result_group,depth.to_i) end
parent_child_add(field_set)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 70 def parent_child_add(field_set) unless presence_check(@@result_group[self.id]) @@result_group[self.id].map{|x| x.parent_child_add(field_set)} @@result_group[nil_check(self.parent_id)].each do|x| next unless x.id == self.id for i in 0..field_set.length-1 x[field_set[i]] = total_calc(@@result_group[self.id],field_set[i]) end end end end
Private Instance Methods
children_group(result_set,args)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 118 def children_group(result_set,args) @@result_group = group_result_set(result_set) parent_child_add(args) end
initial_load(result_set,args)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 113 def initial_load(result_set,args) children_group(result_set,args) @@result_group[nil_check(self.parent_id)].select{|x| x.id == self.id}.first end
linear_load(result_set)
click to toggle source
# File lib/hierarchy/added_hierarchy_level.rb, line 123 def linear_load(result_set) @@linear = initialise_array() group_result_set(result_set) end