Class: RTunnel::RemoteListenCommand

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

Constant Summary collapse

RE =
%r{^([^|]+)\|}

Constants inherited from Command

Command::CLASSES_TO_CODES, Command::CODES_TO_CLASSES

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address) ⇒ RemoteListenCommand

Returns a new instance of RemoteListenCommand.



117
118
119
# File 'lib/cmds.rb', line 117

def initialize(address)
  @address = address
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



115
116
117
# File 'lib/cmds.rb', line 115

def address
  @address
end

Class Method Details

.match(data) ⇒ Object



139
140
141
# File 'lib/cmds.rb', line 139

def match(data)
  !! (data =~ RE)
end

.parse(data) ⇒ Object



128
129
130
131
132
133
134
135
136
137
# File 'lib/cmds.rb', line 128

def parse(data)
  data =~ RE
  address = $1

  cmd = self.new(address)

  data.sub! RE, ''

  cmd
end

Instance Method Details

#to_sObject



121
122
123
# File 'lib/cmds.rb', line 121

def to_s
  super + "#{address}|"
end