Class: PactBroker::Domain::Version
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- PactBroker::Domain::Version
- Defined in:
- lib/pact_broker/domain/version.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#after_create ⇒ Object
Isn’t called on upsert when the record is updated with Sqlite Is called with Postgres/MySQL Haven’t had time to dig into why.
- #before_destroy ⇒ Object
- #head_tags ⇒ Object
- #latest_for_branch? ⇒ Boolean
- #latest_for_pacticipant? ⇒ Boolean
-
#latest_pact_publication ⇒ Object
What about provider??? This makes no sense.
- #to_s ⇒ Object
- #version_and_updated_date ⇒ Object
Instance Method Details
#after_create ⇒ Object
Isn’t called on upsert when the record is updated with Sqlite Is called with Postgres/MySQL Haven’t had time to dig into why
150 151 152 153 154 |
# File 'lib/pact_broker/domain/version.rb', line 150 def after_create super OrderVersions.(self) unless self.order refresh end |
#before_destroy ⇒ Object
156 157 158 159 |
# File 'lib/pact_broker/domain/version.rb', line 156 def before_destroy PactBroker::Domain::Tag.where(version: self).destroy super end |
#head_tags ⇒ Object
169 170 171 |
# File 'lib/pact_broker/domain/version.rb', line 169 def .select(&:latest_for_pacticipant?) end |
#latest_for_branch? ⇒ Boolean
178 179 180 |
# File 'lib/pact_broker/domain/version.rb', line 178 def latest_for_branch? branch ? latest_version_for_branch.order == order : nil end |
#latest_for_pacticipant? ⇒ Boolean
182 183 184 |
# File 'lib/pact_broker/domain/version.rb', line 182 def latest_for_pacticipant? latest_version_for_pacticipant == self end |
#latest_pact_publication ⇒ Object
What about provider??? This makes no sense
174 175 176 |
# File 'lib/pact_broker/domain/version.rb', line 174 def latest_pact_publication pact_publications.last end |
#to_s ⇒ Object
161 162 163 |
# File 'lib/pact_broker/domain/version.rb', line 161 def to_s "Version: number=#{number}, pacticipant=#{pacticipant_id}" end |
#version_and_updated_date ⇒ Object
165 166 167 |
# File 'lib/pact_broker/domain/version.rb', line 165 def version_and_updated_date "Version #{number} - #{updated_at.to_time.localtime.strftime("%d/%m/%Y")}" end |