Class: Vatsim::Server

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

Overview

Server to which clients can connect

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ Server

Initialize Server with colon delimited line from vatsim-data.txt format



8
9
10
11
12
13
14
15
16
# File 'lib/vatsim/server.rb', line 8

def initialize line
  attributes = [:ident, :hostname_or_IP, :location, :name, :clients_connection_allowed]

  line_split = line.split(":")

  attributes.each_with_index.map { |attribute, index|
    instance_variable_set("@#{attribute}", line_split[index]) if self.respond_to?(attribute)
  }
end

Instance Attribute Details

#clients_connection_allowedObject (readonly)

Returns the value of attribute clients_connection_allowed.



5
6
7
# File 'lib/vatsim/server.rb', line 5

def clients_connection_allowed
  @clients_connection_allowed
end

#hostname_or_IPObject (readonly)

Returns the value of attribute hostname_or_IP.



5
6
7
# File 'lib/vatsim/server.rb', line 5

def hostname_or_IP
  @hostname_or_IP
end

#identObject (readonly)

Returns the value of attribute ident.



5
6
7
# File 'lib/vatsim/server.rb', line 5

def ident
  @ident
end

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/vatsim/server.rb', line 5

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/vatsim/server.rb', line 5

def name
  @name
end