lib/arrow/table.rb in red-arrow-0.11.0 vs lib/arrow/table.rb in red-arrow-0.12.0
- old
+ new
@@ -27,10 +27,11 @@
TableLoader.load(path, options)
end
end
alias_method :initialize_raw, :initialize
+ private :initialize_raw
def initialize(schema_or_raw_table_or_columns, columns=nil)
if columns.nil?
if schema_or_raw_table_or_columns[0].is_a?(Column)
columns = schema_or_raw_table_or_columns
fields = columns.collect(&:field)
@@ -268,20 +269,28 @@
column.pack
end
self.class.new(schema, packed_columns)
end
+ alias_method :to_s_raw, :to_s
def to_s(options={})
- case options[:format]
+ format = options[:format]
+ case format
+ when :column
+ return to_s_raw
when :list
formatter_class = TableListFormatter
- else
+ when :table, nil
formatter_class = TableTableFormatter
+ else
+ message = ":format must be :column, :list, :table or nil"
+ raise ArgumentError, "#{message}: <#{format.inspect}>"
end
formatter = formatter_class.new(self, options)
formatter.format
end
+ alias_method :inspect_raw, :inspect
def inspect
"#{super}\n#{to_s}"
end
def respond_to_missing?(name, include_private)