Sha256: eba5b4fc9095d16ce022d8698d49474febdea11e91bf1a83af77d6257b459013

Contents?: true

Size: 559 Bytes

Versions: 3

Compression:

Stored size: 559 Bytes

Contents

class SlackSmartBot
  def update_vacations(vacation=nil)
    require 'yaml'
    unless vacation.nil?
      get_vacations()
      @vacations.merge!(vacation)
    end
    user = Thread.current[:user]
    vacations_file = File.join(config.path, "vacations", "v_#{user.name}.yaml")

    File.open(vacations_file, 'w') {|file|
      file.flock(File::LOCK_EX)
      file.write(Utils::Encryption.encrypt(@vacations[user.name].to_yaml, config))
      file.flock(File::LOCK_UN)
    }
    @datetime_vacations_file[vacations_file] = File.mtime(vacations_file)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-smart-bot-1.14.2 lib/slack/smart-bot/utils/update_vacations.rb
slack-smart-bot-1.14.1 lib/slack/smart-bot/utils/update_vacations.rb
slack-smart-bot-1.14.0 lib/slack/smart-bot/utils/update_vacations.rb