Class: Exodus::MigrationStatus
- Inherits:
-
Object
- Object
- Exodus::MigrationStatus
- Includes:
- MongoMapper::EmbeddedDocument
- Defined in:
- lib/exodus/migrations/migration_status.rb
Instance Method Summary collapse
- #direction_to_i ⇒ Object
-
#reset! ⇒ Object
Resets a status.
-
#status_processed?(migration_direction, status_to_process) ⇒ Boolean
Checks if a status has been processed a Status has been processed when: The current status is superior or equal to the given status and the migration direction is UP The current status is inferior or equal to the given status and the migration direction is DOWN.
- #to_a ⇒ Object
- #to_a_string ⇒ Object
- #to_string ⇒ Object
Instance Method Details
#direction_to_i ⇒ Object
15 16 17 |
# File 'lib/exodus/migrations/migration_status.rb', line 15 def direction_to_i self.direction == Migration::UP ? 1 : -1 end |
#reset! ⇒ Object
Resets a status
40 41 42 43 44 45 |
# File 'lib/exodus/migrations/migration_status.rb', line 40 def reset! self. = nil self.current_status = 0 self.execution_time = 0 self.last_succesful_completion = nil end |
#status_processed?(migration_direction, status_to_process) ⇒ Boolean
Checks if a status has been processed a Status has been processed when: The current status is superior or equal to the given status and the migration direction is UP The current status is inferior or equal to the given status and the migration direction is DOWN
23 24 25 |
# File 'lib/exodus/migrations/migration_status.rb', line 23 def status_processed?(migration_direction, status_to_process) (migration_direction == Migration::UP && current_status >= status_to_process) || (migration_direction == Migration::DOWN && current_status <= status_to_process) end |
#to_a ⇒ Object
31 32 33 |
# File 'lib/exodus/migrations/migration_status.rb', line 31 def to_a [direction, current_status, arguments, last_succesful_completion, ] end |
#to_a_string ⇒ Object
35 36 37 |
# File 'lib/exodus/migrations/migration_status.rb', line 35 def to_a_string self.to_a.map(&:to_s) end |
#to_string ⇒ Object
27 28 29 |
# File 'lib/exodus/migrations/migration_status.rb', line 27 def to_string "\t#{direction}\t\t #{current_status} \t\t #{arguments}\t\t #{last_succesful_completion} \t\t #{}" end |