Class: FCSHD::Server::Client

Inherits:
Struct
  • Object
show all
Defined in:
lib/fcshd/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#compilerObject

Returns the value of attribute compiler

Returns:

  • (Object)

    the current value of compiler



21
22
23
# File 'lib/fcshd/server.rb', line 21

def compiler
  @compiler
end

#socketObject

Returns the value of attribute socket

Returns:

  • (Object)

    the current value of socket



21
22
23
# File 'lib/fcshd/server.rb', line 21

def socket
  @socket
end

Instance Method Details

#run!Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fcshd/server.rb', line 22

def run!
  case command = socket.gets.chomp
  when /^(mxmlc|compc) /
    compiler.compile! command, socket
  when "restart"
    compiler.restart!
    socket.puts "fcshd: compiler restarted"
  when "sdk-version"
    socket.puts compiler.sdk_version
  else
    socket.puts "fcshd: unrecognized command: #{command}"
  end
rescue Errno::EPIPE
  logger.log "Broken pipe."
ensure
  socket.close
end