Sha256: 38c3ea950f1a319a3b716af439a6557711a305e65d3bc5c298b1b7a1f91ef466
Contents?: true
Size: 666 Bytes
Versions: 3
Compression:
Stored size: 666 Bytes
Contents
class SlackSmartBot def update_rules_imported require 'yaml' file_path = "#{config.path}/rules/rules_imported" if File.exist?("#{file_path}.rb") #backwards compatible file_conf = IO.readlines("#{file_path}.rb").join if file_conf.to_s() == "" @rules_imported = {} else @rules_imported = eval(file_conf) end File.open("#{file_path}.yaml", 'w') {|file| file.write(@rules_imported.to_yaml) } File.delete("#{file_path}.rb") end File.open("#{file_path}.yaml", 'w') {|file| file.flock(File::LOCK_EX) file.write(@rules_imported.to_yaml) file.flock(File::LOCK_UN) } end end
Version data entries
3 entries across 3 versions & 1 rubygems