Class: Neo4j::ActiveNode::NodeListFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/active_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/neo4j/active_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/neo4j/active_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