Class: McDump::Telnet::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/mc_dump/telnet/connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Connection

Returns a new instance of Connection.


6
7
8
9
10
11
12
# File 'lib/mc_dump/telnet/connection.rb', line 6

def initialize(args)
  @telnet = Net::Telnet::new(
    "Host"    => args[:host],
    "Port"    => args[:port],
    "Timeout" => args[:timeout_in_seconds] || 5
  )
end

Instance Method Details

#closeObject


18
19
20
# File 'lib/mc_dump/telnet/connection.rb', line 18

def close
  @telnet.close
end

#execute(string) ⇒ Object


14
15
16
# File 'lib/mc_dump/telnet/connection.rb', line 14

def execute(string)
  @telnet.cmd("String" => string, "Match" => /^END/)
end