Class: RTunnel::SendDataCommand

Inherits:
ConnectionCommand show all
Defined in:
lib/rtunnel/commands.rb

Instance Attribute Summary collapse

Attributes inherited from ConnectionCommand

#connection_id

Instance Method Summary collapse

Methods inherited from Command

command_code, decode, printable_codes, registry, #to_encoded_str

Constructor Details

#initialize(connection_id = nil, data = nil) ⇒ SendDataCommand

Returns a new instance of SendDataCommand.



126
127
128
129
# File 'lib/rtunnel/commands.rb', line 126

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

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



124
125
126
# File 'lib/rtunnel/commands.rb', line 124

def data
  @data
end

Instance Method Details

#encode(io) ⇒ Object



141
142
143
144
# File 'lib/rtunnel/commands.rb', line 141

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

#initialize_from_io(io) ⇒ Object



131
132
133
134
135
# File 'lib/rtunnel/commands.rb', line 131

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

#to_sObject



137
138
139
# File 'lib/rtunnel/commands.rb', line 137

def to_s
  super + "/data=#{data}"
end