class PactBroker::Versions::BranchVersion

Public Instance Methods

before_save() click to toggle source
Calls superclass method
# File lib/pact_broker/versions/branch_version.rb, line 22
def before_save
  super
  self.version_order = version.order
  self.pacticipant_id = version.pacticipant_id
  self.branch_name = branch.name
end
find_latest_for_branch(branch) click to toggle source
# File lib/pact_broker/versions/branch_version.rb, line 16
def find_latest_for_branch(branch)
  max_version_order = BranchVersion.select(Sequel.function(:max, :version_order)).where(branch_id: branch.id)
  BranchVersion.where(branch_id: branch.id, version_order: max_version_order).single_record
end
latest?() click to toggle source
# File lib/pact_broker/versions/branch_version.rb, line 29
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
pacticipant() click to toggle source
# File lib/pact_broker/versions/branch_version.rb, line 38
def pacticipant
  branch.pacticipant
end
version_number() click to toggle source
# File lib/pact_broker/versions/branch_version.rb, line 34
def version_number
  version.number
end