Class: CurationConcerns::VersioningService
- Inherits:
-
Object
- Object
- CurationConcerns::VersioningService
- Defined in:
- app/services/curation_concerns/versioning_service.rb
Class Method Summary collapse
-
.create(content, user = nil) ⇒ Object
Make a version and record the version committer.
- .latest_version_of(file) ⇒ Object
-
.record_committer(content, user_key) ⇒ Object
Record the version committer of the last version.
Class Method Details
.create(content, user = nil) ⇒ Object
Make a version and record the version committer
6 7 8 9 |
# File 'app/services/curation_concerns/versioning_service.rb', line 6 def self.create(content, user = nil) content.create_version record_committer(content, user) if user end |
.latest_version_of(file) ⇒ Object
12 13 14 |
# File 'app/services/curation_concerns/versioning_service.rb', line 12 def self.latest_version_of(file) file.versions.last end |
.record_committer(content, user_key) ⇒ Object
Record the version committer of the last version
19 20 21 22 23 24 |
# File 'app/services/curation_concerns/versioning_service.rb', line 19 def self.record_committer(content, user_key) user_key = user_key.user_key if user_key.respond_to?(:user_key) version = latest_version_of(content) return if version.nil? VersionCommitter.create(version_id: version.uri, committer_login: user_key) end |