Class: ActiveGraph::Node::NodeListFormatter
- Inherits:
-
Object
- Object
- ActiveGraph::Node::NodeListFormatter
- Defined in:
- lib/active_graph/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/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
#inspect ⇒ Object
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 |