Class: DryRunReporter
- Inherits:
-
Object
- Object
- DryRunReporter
- Defined in:
- lib/dry_run_reporter.rb
Instance Attribute Summary collapse
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Instance Method Summary collapse
- #add_to_report(*args) ⇒ Object
-
#initialize ⇒ DryRunReporter
constructor
A new instance of DryRunReporter.
- #print_report ⇒ Object
Constructor Details
#initialize ⇒ DryRunReporter
Returns a new instance of DryRunReporter.
6 7 8 |
# File 'lib/dry_run_reporter.rb', line 6 def initialize @report = {} end |
Instance Attribute Details
#report ⇒ Object (readonly)
Returns the value of attribute report.
4 5 6 |
# File 'lib/dry_run_reporter.rb', line 4 def report @report end |
Instance Method Details
#add_to_report(*args) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/dry_run_reporter.rb', line 10 def add_to_report(*args) if args.first.is_a?(Hash) add_to_report_as_hash(args.first) else add_to_report_as_key_and_values(*args) end end |
#print_report ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dry_run_reporter.rb', line 18 def print_report if @report.to_a.map(&:second).flatten.empty? puts 'Dry run active. No data would be removed in normal run.' else puts 'Dry run active. The following data would be removed in normal run:' @report.to_a.map(&:first).each do |symbol| print_report_line(symbol) end end end |