Class: Sprout::FlashPlayerTrust

Inherits:
Object
  • Object
show all
Defined in:
lib/sprout/flash_player_task.rb

Overview

FlashPlayerTrust Class

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FlashPlayerTrust

Returns a new instance of FlashPlayerTrust.



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/sprout/flash_player_task.rb', line 289

def initialize(path)
  trust_file = FlashPlayerTask.trust
  if(!File.exists?(trust_file))
    FileUtils.touch(trust_file)
  end

  parts = path.split(File::SEPARATOR)
  if(parts.size == 1)
    path = File::SEPARATOR + path
  end

  if(!has_path?(trust_file, path))
    File.open(trust_file, 'a') do |f|
      f.puts path
    end
    Log.puts ">> Added #{path} to Flash Player Trust file at: #{trust_file}"
  end
end

Instance Method Details

#has_path?(file, path) ⇒ Boolean

Returns:

  • (Boolean)


308
309
310
311
312
# File 'lib/sprout/flash_player_task.rb', line 308

def has_path?(file, path)
  File.open(file, 'r') do |f|
    return (f.read.index(path))
  end
end