Class: PactBroker::Versions::BranchVersion
- Inherits:
-
Object
- Object
- PactBroker::Versions::BranchVersion
- Defined in:
- lib/pact_broker/versions/branch_version.rb
Instance Method Summary collapse
- #before_save ⇒ Object
- #latest? ⇒ Boolean
-
#main_branch? ⇒ Boolean
For Pactflow.
-
#number_of_versions_from_head ⇒ Object
For Pactflow.
- #pacticipant ⇒ Object
- #version_number ⇒ Object
Instance Method Details
#before_save ⇒ Object
20 21 22 23 24 25 |
# File 'lib/pact_broker/versions/branch_version.rb', line 20 def before_save super self.version_order = version.order self.pacticipant_id = version.pacticipant_id self.branch_name = branch.name end |
#latest? ⇒ Boolean
27 28 29 30 |
# File 'lib/pact_broker/versions/branch_version.rb', line 27 def latest? # Should not be possible, not to have a branch head, but have seen this error in the logs branch_head&.branch_version_id == id end |
#main_branch? ⇒ Boolean
For Pactflow
41 42 43 |
# File 'lib/pact_broker/versions/branch_version.rb', line 41 def main_branch? branch_name == branch.pacticipant.main_branch end |
#number_of_versions_from_head ⇒ Object
For Pactflow
46 47 48 |
# File 'lib/pact_broker/versions/branch_version.rb', line 46 def number_of_versions_from_head @number_of_versions_from_head ||= BranchVersion.where(branch_id: branch_id).where(Sequel.lit("version_order > ?", version_order) ).count end |
#pacticipant ⇒ Object
36 37 38 |
# File 'lib/pact_broker/versions/branch_version.rb', line 36 def pacticipant branch.pacticipant end |
#version_number ⇒ Object
32 33 34 |
# File 'lib/pact_broker/versions/branch_version.rb', line 32 def version_number version.number end |