Method: FatTable::Table.from_aoh
- Defined in:
- lib/fat_table/table.rb
.from_aoh(aoh, hlines: false, **types) ⇒ Object
Construct a Table from +aoh+, an Array of Hashes or an Array of any objects that respond to the #to_h method. All hashes must have the same keys, which, when converted to symbols will become the headers for the Table. If hlines is set true, mark a group boundary whenever a nil, rather than a hash appears in the outer array.
223 224 225 226 227 228 229 230 |
# File 'lib/fat_table/table.rb', line 223 def self.from_aoh(aoh, hlines: false, **types) if aoh.first.respond_to?(:to_h) from_array_of_hashes(aoh, hlines: hlines, **types) else raise UserError, "Cannot initialize Table with an array of #{input[0].class}" end end |