lib/terminal-table/table.rb in visionmedia-terminal-table-1.0.5 vs lib/terminal-table/table.rb in visionmedia-terminal-table-1.1.0
- old
+ new
@@ -4,11 +4,11 @@
##
# Generates an ASCII table for terminal usage.
#
# This class can be used in many ways, however ultimately you should
# require 'terminal-table/import' (which requires terminal-table itself) to use
- # the Kernel helper method which is easier, and cleaner to use. View Kernel#table
+ # the Kernel helper method which is easier, and cleaner to use. View Object#table
# for examples.
#
# === Examples:
#
# table = Terminal::Table.new
@@ -153,7 +153,16 @@
def headings_with_rows
[headings] + rows
end
+ ##
+ # Check if +other+ is equal to self. +other+ is considered equal
+ # if it contains the same headings and rows.
+
+ def == other
+ if other.respond_to?(:headings) && other.respond_to?(:rows)
+ headings == other.headings && rows == other.rows
+ end
+ end
end
-end
\ No newline at end of file
+end