Class: ActiveGraph::Node::NodeListFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_graph/node/node_list_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(list, max_elements = 5) ⇒ NodeListFormatter

Returns a new instance of NodeListFormatter.



3
4
5
6
# File 'lib/active_graph/node/node_list_formatter.rb', line 3

def initialize(list, max_elements = 5)
  @list = list
  @max_elements = max_elements
end

Instance Method Details

#inspectObject



8
9
10
11
# File 'lib/active_graph/node/node_list_formatter.rb', line 8

def inspect
  return @list.inspect if !@max_elements || @list.length <= @max_elements
  "[#{@list.take(5).map!(&:inspect).join(', ')}, ...]"
end