Sha256: 16be06c553d728cb98face628cb9f6c77dc0f19d50bf486280c881d37a8d1e93
Contents?: true
Size: 624 Bytes
Versions: 2
Compression:
Stored size: 624 Bytes
Contents
# frozen_string_literal: true module Acb module Base extend ActiveSupport::Concern module ClassMethods include Columns end def to_csv(**options) CSV.generate(**options) do |csv| csv << self.class.header data.each do |row| csv << summarize(row) end end end alias content_string to_csv def load_from(relations) @data = relations end private def data @data = @data.preload(relations) if respond_to?(:relations) @data.find_each end def summarize(row) self.class.summarize(row) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acb-0.2.1 | lib/acb/base.rb |
acb-0.2.0 | lib/acb/base.rb |