Class: Tree::Pairs

Inherits:
Enumerator
  • Object
show all
Defined in:
lib/modular_tree/pairs.rb

Instance Method Summary collapse

Instance Method Details

#foldObject

Turn into a nested array tree



10
# File 'lib/modular_tree/pairs.rb', line 10

def fold = abstract_method

#groupObject



3
4
5
6
7
# File 'lib/modular_tree/pairs.rb', line 3

def group
  h = {}
  each { |first, last| (h[first] ||= []) << last }
  h.each
end

#to_hObject



12
# File 'lib/modular_tree/pairs.rb', line 12

def to_h = abstract_method