Method: Daru::Vector#inspect

Defined in:
lib/daru/vector.rb

#inspect(spacing = 20, threshold = 15) ⇒ Object

Over rides original inspect for pretty printing in irb



1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/daru/vector.rb', line 1107

def inspect spacing=20, threshold=15
  row_headers = index.is_a?(MultiIndex) ? index.sparse_tuples : index.to_a

  "#<#{self.class}(#{size})#{':category' if category?}>\n" +
    Formatters::Table.format(
      to_a.lazy.map { |v| [v] },
      headers: @name && [@name],
      row_headers: row_headers,
      threshold: threshold,
      spacing: spacing
    )
end