Module: TableTennis::Util::Inspectable
- Included in:
- Column, Stage::Base, Table, TableData
- Defined in:
- lib/table_tennis/util/inspectable.rb
Overview
A mixin to avoid putting all row data into xxx.inspect. This makes development much easier.
Instance Method Summary collapse
Instance Method Details
#inspect ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/table_tennis/util/inspectable.rb', line 6 def inspect vars = instance_variables.filter_map do next if _1 == :@data || _1 == :@_memo_wise value = instance_variable_get(_1) if value.is_a?(Array) && _1.to_s =~ /rows$/ value = if value.length == 1 "[1 row]" else "[#{value.length} rows]" end end "#{_1}=#{value.inspect}" end.join(" ") "<#{self.class.name} #{vars}>" end |