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.
12 13 14 15 16 |
# File 'lib/clix_flash_player.rb', line 12 def initialize @activate_pid = nil @player_pid = nil @thread = nil end |
Instance Method Details
#alive? ⇒ Boolean
41 42 43 |
# File 'lib/clix_flash_player.rb', line 41 def alive? return @thread.alive? end |
#execute(player, swf) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/clix_flash_player.rb', line 18 def execute(player, swf) cleanup validate(player, swf) player = File.(File.join(player, 'Contents', 'MacOS', 'Flash Player')) swf = File.(swf) setup_trap @thread = Thread.new { @player_pid = open4.popen4("#{player.split(' ').join('\ ')}")[0] wrapper = File.(File.dirname(__FILE__) + '/clix_wrapper.rb') command = "ruby #{wrapper} '#{player}' '#{swf}'" @activate_pid = open4.popen4(command)[0] Process.wait(@player_pid) } end |
#join ⇒ Object
37 38 39 |
# File 'lib/clix_flash_player.rb', line 37 def join @thread.join end |
#kill ⇒ Object
33 34 35 |
# File 'lib/clix_flash_player.rb', line 33 def kill system("kill -9 #{@player_pid}") end |