lib/tabledata/table.rb
def accessors_from_headers!
      raise "Can't define accessors from headers in a table without headers" unless @has_headers

      self.accessors = headers.map { |val| (val && !val.empty?) ? val.to_s.downcase.tr('^a-z0-9_', '_').squeeze('_').gsub(/\A_|_\z/, '').to_sym : nil }
    end
def accessors_from_headers!
      raise "Can't define accessors from headers in a table without headers" unless @has_headers

      self.accessors = headers.map { |val| (val && !val.empty?) ? val.to_s.downcase.tr('^a-z0-9_', '_').squeeze('_').gsub(/\A_|_\z/, '').to_sym : nil }
    end
Create a new table.

 @param [Hash] options
   A list of options. Mostly identical to {Table#initialize}'s options
   hash, but with the additional options :file_type and :table_class.

 @option options [String] :name
   The name of the table
 @option options [Array<Symbol>, Hash<Symbol => Integer>, nil] :accessors
   A list of accessors for the columns. Allows accessing columns by that accessor.
 @option options [Symbol] :data
   An array of arrays with the table data. Mutually exclusive with
   :header, :body and :footer.
 @option options [Symbol] :header
   An array with the header values. To be used together with :body and :footer.
   Mutually exclusive with :data.
   Automatically sets :has_headers to true.
 @option options [Symbol] :body
   An array with the header values. To be used together with :header and :footer.
   Mutually exclusive with :data.
   Automatically sets :has_headers to false if :header is not also present.
   Automatically sets :has_footer to false if :footer is not also present.
 @option options [Symbol] :footer
   An array with the header values. To be used together with :header and :body.
   Mutually exclusive with :data.
   Automatically sets :has_footer to true.
 @option options [true, false] :has_headers
   Whether the table has a header, defaults to true
 @option options [true, false] :has_footer
   Whether the table has a footer, defaults to false

 Automatically create accessors from the headers of the table.
 It does that by downcasing the headers, replace everything which is not in [a-z0-9_] with an _,
 replace all repeated occurrences of _ with a single _.

 @note
   The actual transformation algorithm might change in the future.