module Rambling::Trie::Inspectable

Provides pretty printing behavior for the trie data structure.

Public Instance Methods

inspect() click to toggle source

@return [String] a string representation of the current node.

# File lib/rambling/trie/inspectable.rb, line 8
def inspect
  "#<#{class_name} #{attributes}>"
end

Private Instance Methods

attributes() click to toggle source
# File lib/rambling/trie/inspectable.rb, line 18
def attributes
  [
    letter_inspect,
    terminal_inspect,
    children_inspect,
  ].join ', '
end
children_inspect() click to toggle source
# File lib/rambling/trie/inspectable.rb, line 34
def children_inspect
  "children: #{children_tree.keys.inspect}"
end
class_name() click to toggle source
# File lib/rambling/trie/inspectable.rb, line 14
def class_name
  self.class.name
end
letter_inspect() click to toggle source
# File lib/rambling/trie/inspectable.rb, line 26
def letter_inspect
  "letter: #{letter.inspect}"
end
terminal_inspect() click to toggle source
# File lib/rambling/trie/inspectable.rb, line 30
def terminal_inspect
  "terminal: #{terminal.inspect}"
end