Class: CLIXFlashPlayer
- Inherits:
-
Object
- Object
- CLIXFlashPlayer
- Defined in:
- lib/clix_flash_player.rb
Constant Summary collapse
- VERSION =
'0.1.0'
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #execute(player, swf) ⇒ Object
-
#initialize ⇒ CLIXFlashPlayer
constructor
A new instance of CLIXFlashPlayer.
- #join ⇒ Object
- #kill ⇒ Object
Constructor Details
#initialize ⇒ CLIXFlashPlayer
Returns a new instance of CLIXFlashPlayer.
14 15 16 17 18 |
# File 'lib/clix_flash_player.rb', line 14 def initialize @activate_pid = nil @player_pid = nil @thread = nil end |
Instance Method Details
#alive? ⇒ Boolean
48 49 50 |
# File 'lib/clix_flash_player.rb', line 48 def alive? return @thread.alive? end |
#execute(player, swf) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/clix_flash_player.rb', line 20 def execute(player, swf) cleanup player = clean_path(player) swf = clean_path(swf) validate(player, swf) if(!player.match('Contents/MacOS')) player = File.join(player, 'Contents', 'MacOS', 'Flash Player') end setup_trap @thread = Thread.new { @player_pid = open4.popen4("#{player.split(' ').join('\ ')}")[0] raise "clix_wrapper.rb could not be found at: #{wrapper}" if !File.exists?($CLIX_WRAPPER_TARGET) command = "ruby #{$CLIX_WRAPPER_TARGET} '#{player}' '#{swf}'" @activate_pid = open4.popen4(command)[0] Process.wait(@player_pid) } end |
#join ⇒ Object
44 45 46 |
# File 'lib/clix_flash_player.rb', line 44 def join @thread.join end |
#kill ⇒ Object
40 41 42 |
# File 'lib/clix_flash_player.rb', line 40 def kill system("kill -9 #{@player_pid}") end |