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
Instance Attribute Summary collapse
-
#boolean ⇒ Object
readonly
Returns the value of attribute boolean.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
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.
18 19 20 21 22 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 18 def initialize(tags:, output:, boolean: :and) @tags = @output = output @boolean = boolean end |
Instance Attribute Details
#boolean ⇒ Object (readonly)
Returns the value of attribute boolean.
12 13 14 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 12 def boolean @boolean end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
12 13 14 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 12 def output @output end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
12 13 14 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 12 def @tags end |
Class Method Details
.call ⇒ Object
8 9 10 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 8 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kiba/extend/command/project/empty_field_report.rb', line 24 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 |