Class: RTunnel::ConnectionCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/rtunnel/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_code, decode, printable_codes, registry, #to_encoded_str

Constructor Details

#initialize(connection_id = nil) ⇒ ConnectionCommand

Returns a new instance of ConnectionCommand.



92
93
94
95
# File 'lib/rtunnel/commands.rb', line 92

def initialize(connection_id = nil)
  super()
  @connection_id = connection_id
end

Instance Attribute Details

#connection_idObject (readonly)

Returns the value of attribute connection_id.



90
91
92
# File 'lib/rtunnel/commands.rb', line 90

def connection_id
  @connection_id
end

Instance Method Details

#encode(io) ⇒ Object



107
108
109
110
# File 'lib/rtunnel/commands.rb', line 107

def encode(io)
  super
  io.write_varstring @connection_id
end

#initialize_from_io(io) ⇒ Object



101
102
103
104
105
# File 'lib/rtunnel/commands.rb', line 101

def initialize_from_io(io)
  super
  @connection_id = io.read_varstring
  self
end

#to_sObject



97
98
99
# File 'lib/rtunnel/commands.rb', line 97

def to_s
  super + "/id=#{connection_id}"
end