Module: GdprExporter
- Defined in:
- lib/gdpr_exporter.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Constant Summary collapse
- @@klasses =
Stores all the classes that have been tagged for gdpr collection
Set[]
Class Method Summary collapse
- .add_klass(klass) ⇒ Object
-
.export(user_id) ⇒ Object
Collects data through all the tagged models and generates a csv formatted output.
- .get_klasses ⇒ Object
-
.included(base) ⇒ Object
Instruments the classes implementing this module with instance and class methods.
Class Method Details
.add_klass(klass) ⇒ Object
14 15 16 |
# File 'lib/gdpr_exporter.rb', line 14 def self.add_klass(klass) @@klasses << klass end |
.export(user_id) ⇒ Object
Collects data through all the tagged models and generates a csv formatted output
20 21 22 23 24 25 26 27 |
# File 'lib/gdpr_exporter.rb', line 20 def self.export(user_id) CSV.generate(force_quotes: true) do |csv| get_klasses.each do |klass| rows = klass.gdpr_query(user_id) klass.gdpr_export(rows, csv) end end end |
.get_klasses ⇒ Object
10 11 12 |
# File 'lib/gdpr_exporter.rb', line 10 def self.get_klasses @@klasses end |
.included(base) ⇒ Object
Instruments the classes implementing this module with instance and class methods.
31 32 33 34 |
# File 'lib/gdpr_exporter.rb', line 31 def self.included base base.send :include, InstanceMethods base.extend ClassMethods end |