Class: Neo4j::ActiveNode::NodeListFormatter
- Inherits:
-
Object
- Object
- Neo4j::ActiveNode::NodeListFormatter
- Defined in:
- lib/neo4j/active_node/node_list_formatter.rb
Instance Method Summary collapse
-
#initialize(list, max_elements = 5) ⇒ NodeListFormatter
constructor
A new instance of NodeListFormatter.
- #inspect ⇒ Object
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
#inspect ⇒ Object
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 |