Class: CLIXFlashPlayer

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

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Constructor Details

#initializeCLIXFlashPlayer

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

Returns:

  • (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.expand_path(File.join(player, 'Contents', 'MacOS', 'Flash Player'))
  swf = File.expand_path(swf)
  setup_trap
  @thread = Thread.new {
    @player_pid = open4.popen4("#{player.split(' ').join('\ ')}")[0]
    wrapper = File.expand_path(File.dirname(__FILE__) + '/clix_wrapper.rb')
    command = "ruby #{wrapper} '#{player}' '#{swf}'"
    @activate_pid = open4.popen4(command)[0]
    Process.wait(@player_pid)
  }
end

#joinObject



37
38
39
# File 'lib/clix_flash_player.rb', line 37

def join
  @thread.join
end

#killObject



33
34
35
# File 'lib/clix_flash_player.rb', line 33

def kill
  system("kill -9 #{@player_pid}")
end