Class: Kiba::Extend::Command::Project::EmptyFieldReport
- Inherits:
-
Object
- Object
- Kiba::Extend::Command::Project::EmptyFieldReport
- Defined in:
- lib/kiba/extend/command/project/empty_field_report.rb
Overview
Writes report of all empty fields in files at the paths specified by the registry entries selected by the given tags
Instance Attribute Summary collapse
-
#boolean ⇒ Object
readonly
-
#output ⇒ Object
readonly
-
#tags ⇒ Object
readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
-
#initialize(tags:, output:, boolean: :and) ⇒ EmptyFieldReport
constructor
A new instance of EmptyFieldReport.
Constructor Details
#initialize(tags:, output:, boolean: :and) ⇒ EmptyFieldReport
Returns a new instance of EmptyFieldReport.
21 22 23 24 25 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 21 def initialize(tags:, output:, boolean: :and) @tags = @output = output @boolean = boolean end |
Instance Attribute Details
#boolean ⇒ Object (readonly)
15 16 17 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 15 def boolean @boolean end |
#output ⇒ Object (readonly)
15 16 17 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 15 def output @output end |
#tags ⇒ Object (readonly)
15 16 17 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 15 def @tags end |
Class Method Details
.call ⇒ Object
11 12 13 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 11 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 27 def call headers = %i[table field] CSV.open(output, "w", headers: headers, write_headers: true) do |csv| entries.map { |entry| id_empty_fields(entry) } .flatten .each { |row| csv << row.values_at(*headers) } end puts "Wrote empty field report to #{output}" end |