Class: Huff::EncodingTreeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/huff/encoding_tree_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(frequencies) ⇒ EncodingTreeBuilder

Returns a new instance of EncodingTreeBuilder.



3
4
5
# File 'lib/huff/encoding_tree_builder.rb', line 3

def initialize(frequencies)
  @frequencies = frequencies
end

Instance Method Details

#simplified_treeObject



11
12
13
# File 'lib/huff/encoding_tree_builder.rb', line 11

def simplified_tree
  simplify(tree)
end

#treeObject



7
8
9
# File 'lib/huff/encoding_tree_builder.rb', line 7

def tree
  create_tree(@frequencies).first
end