Class: SynchronisedMigration::Result
- Inherits:
-
Object
- Object
- SynchronisedMigration::Result
- Defined in:
- lib/synchronised_migration/result.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
- .migration_already_completed ⇒ Object
- .migration_failed ⇒ Object
- .ok ⇒ Object
- .previous_migration_failed ⇒ Object
Instance Method Summary collapse
- #error_msg ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(code) ⇒ Result
constructor
A new instance of Result.
- #successful? ⇒ Boolean
Constructor Details
#initialize(code) ⇒ Result
Returns a new instance of Result.
15 16 17 |
# File 'lib/synchronised_migration/result.rb', line 15 def initialize(code) @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
13 14 15 |
# File 'lib/synchronised_migration/result.rb', line 13 def code @code end |
Class Method Details
.migration_already_completed ⇒ Object
40 41 42 |
# File 'lib/synchronised_migration/result.rb', line 40 def self.migration_already_completed new(PREVIOUS_SUCCESS) end |
.migration_failed ⇒ Object
48 49 50 |
# File 'lib/synchronised_migration/result.rb', line 48 def self.migration_failed new(MIGRATION_FAILED) end |
.ok ⇒ Object
36 37 38 |
# File 'lib/synchronised_migration/result.rb', line 36 def self.ok new(MIGRATION_SUCCESS) end |
.previous_migration_failed ⇒ Object
44 45 46 |
# File 'lib/synchronised_migration/result.rb', line 44 def self.previous_migration_failed new(PREVIOUS_FAILED) end |
Instance Method Details
#error_msg ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/synchronised_migration/result.rb', line 27 def error_msg case code when MIGRATION_FAILED MIGRATION_FAILED_MSG when PREVIOUS_FAILED PREVIOUS_FAILED_MSG end end |
#failure? ⇒ Boolean
23 24 25 |
# File 'lib/synchronised_migration/result.rb', line 23 def failure? !successful? end |
#successful? ⇒ Boolean
19 20 21 |
# File 'lib/synchronised_migration/result.rb', line 19 def successful? [MIGRATION_SUCCESS, PREVIOUS_SUCCESS].include?(code) end |