Class: Nandi::MigrationViolations
- Inherits:
-
Object
- Object
- Nandi::MigrationViolations
- Defined in:
- lib/nandi/migration_violations.rb
Instance Method Summary collapse
- #add_hand_edited(altered_files, directory) ⇒ Object
- #add_handwritten(handwritten_files, directory) ⇒ Object
- #add_out_of_date(changed_files, directory) ⇒ Object
- #add_ungenerated(missing_files, directory) ⇒ Object
- #any? ⇒ Boolean
-
#initialize ⇒ MigrationViolations
constructor
A new instance of MigrationViolations.
- #to_error_message ⇒ Object
Constructor Details
#initialize ⇒ MigrationViolations
Returns a new instance of MigrationViolations.
5 6 7 8 9 10 |
# File 'lib/nandi/migration_violations.rb', line 5 def initialize @ungenerated_files = [] @handwritten_files = [] @out_of_date_files = [] @hand_edited_files = [] end |
Instance Method Details
#add_hand_edited(altered_files, directory) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/nandi/migration_violations.rb', line 33 def add_hand_edited(altered_files, directory) return if altered_files.empty? full_paths = build_full_paths(altered_files, directory) @hand_edited_files.concat(full_paths) end |
#add_handwritten(handwritten_files, directory) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/nandi/migration_violations.rb', line 19 def add_handwritten(handwritten_files, directory) return if handwritten_files.empty? full_paths = build_full_paths(handwritten_files, directory) @handwritten_files.concat(full_paths) end |
#add_out_of_date(changed_files, directory) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/nandi/migration_violations.rb', line 26 def add_out_of_date(changed_files, directory) return if changed_files.empty? full_paths = build_full_paths(changed_files, directory) @out_of_date_files.concat(full_paths) end |
#add_ungenerated(missing_files, directory) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/nandi/migration_violations.rb', line 12 def add_ungenerated(missing_files, directory) return if missing_files.empty? full_paths = build_full_paths(missing_files, directory) @ungenerated_files.concat(full_paths) end |
#any? ⇒ Boolean
40 41 42 |
# File 'lib/nandi/migration_violations.rb', line 40 def any? [@ungenerated_files, @handwritten_files, @out_of_date_files, @hand_edited_files].any?(&:any?) end |
#to_error_message ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/nandi/migration_violations.rb', line 44 def = [] << ungenerated_error if @ungenerated_files.any? << handwritten_error if @handwritten_files.any? << out_of_date_error if @out_of_date_files.any? << hand_edited_error if @hand_edited_files.any? .join("\n\n") end |