class Unitylock::Server::Service

Attributes

model[RW]

Public Class Methods

new(model) click to toggle source
# File lib/unitylock/server/service.rb, line 7
def initialize(model)
  @model = model
end

Public Instance Methods

deletes(*files) click to toggle source
# File lib/unitylock/server/service.rb, line 27
def deletes(*files)
  files.each do |file|
    @model.delete(file: file)
  end
end
lock(file:,user:) click to toggle source
# File lib/unitylock/server/service.rb, line 33
def lock(file:,user:)
  @model.lock(file: file, user: user)
end
search_by_files(*files) click to toggle source
# File lib/unitylock/server/service.rb, line 15
def search_by_files(*files)
  @model.search
    .select {|it| files.include? it.file }
    .collect {|it| it.to_hash }
end
touches(*files) click to toggle source
# File lib/unitylock/server/service.rb, line 21
def touches(*files)
  files.each do |file|
    @model.create_or_update(file: file)
  end
end
unlock(file:,user:) click to toggle source
# File lib/unitylock/server/service.rb, line 37
def unlock(file:,user:)
  @model.unlock(file: file, user: user)
end