Class: Vetinari::Dcc::Server

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/vetinari/dcc/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, filepath, filename, server_manager) ⇒ Server

Returns a new instance of Server.



8
9
10
11
12
13
14
# File 'lib/vetinari/dcc/server.rb', line 8

def initialize(user, filepath, filename, server_manager)
  @user = user
  @filepath = filepath
  @filename = filename
  @server_manager = server_manager
  @state = :idling
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



6
7
8
# File 'lib/vetinari/dcc/server.rb', line 6

def filepath
  @filepath
end

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/vetinari/dcc/server.rb', line 6

def state
  @state
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'lib/vetinari/dcc/server.rb', line 6

def user
  @user
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/vetinari/dcc/server.rb', line 22

def inspect
  "#<Server @user=#{@user.inspect} @filepath=#{filepath}"
end

#run(port) ⇒ Object



16
17
18
19
20
# File 'lib/vetinari/dcc/server.rb', line 16

def run(port)
  @port = port
  register_resume_callback
  start
end