Class: SteamMist::Rcon

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/steam_mist/rcon.rb,
lib/steam_mist/rcon/pass.rb,
lib/steam_mist/rcon/packet.rb,
lib/steam_mist/rcon/listener.rb,
lib/steam_mist/rcon/packet_factory.rb

Overview

This class provides RCON capabilities.

Defined Under Namespace

Classes: Listener, Packet, PacketFactory, Pass, TimeoutError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip, port = 27015) ⇒ Rcon

Initialize.

Parameters:

  • ip (String)

    the IP to connect to.

  • port (Numeric) (defaults to: 27015)

    the port to connect to.



24
25
26
# File 'lib/steam_mist/rcon.rb', line 24

def initialize(ip, port = 27015)
  @pass = Pass.new(ip, port)
end

Instance Attribute Details

#passPass (readonly)

This is the class that handles reading and writing packets from the listener.

Returns:



18
19
20
# File 'lib/steam_mist/rcon.rb', line 18

def pass
  @pass
end

Instance Method Details

#inspectString

Pretty inspect

Returns:

  • (String)


39
40
41
# File 'lib/steam_mist/rcon.rb', line 39

def inspect
  "#<SteamMist::Rcon>"
end

#send(hash) ⇒ Packet+

This takes a hash, turns it into a packet, and sends it.

Parameters:

  • hash (Hash)

    the data to turn into a packet.

Returns:



32
33
34
# File 'lib/steam_mist/rcon.rb', line 32

def send(hash)
  send_packet packet_factory.create_packet.load!(hash)
end