lib/table_print/fingerprinter.rb in table_print-1.0.1 vs lib/table_print/fingerprinter.rb in table_print-1.1.0

- old
+ new

@@ -10,10 +10,12 @@ end def hash_to_rows(prefix, hash, objects) rows = [] + + # convert each object into its own row Array(objects).each do |target| row = populate_row(prefix, hash, target) rows << row @@ -30,10 +32,12 @@ # populate a row with the columns we handle cells = {} handleable_columns(hash).each do |method| display_method = (prefix == "" ? method : "#{prefix}.#{method}") - if method.is_a? Proc + if target.is_a? Hash + cell_value = target[method.to_sym] + elsif method.is_a? Proc cell_value = method.call(target) else cell_value ||= target.send(method) end cells[@column_names_by_display_method[display_method]] = cell_value