# Embedding a library into a method

**URL:** <https://www.ruby-forum.com/t/embedding-a-library-into-a-method/167826>\
**Category:** Ruby\
**Created:** [May 13, 2009, 1:41am UTC](https://www.ruby-forum.com/t/embedding-a-library-into-a-method/167826 "2009-05-13T01:41:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathspeedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@Mathspeedy](https://www.ruby-forum.com/u/Mathspeedy)\
**Post date:** [May 13, 2009, 1:41am UTC](https://www.ruby-forum.com/t/embedding-a-library-into-a-method/167826/1 "2009-05-13T01:41:10Z")

</div>

Hi all,  
I wanted to embed the Net::Telnet into a method, just look my code …

#CODE start here  
#!/usr/bin/ruby

require “net/telnet”

class VictimInfo  
attr\_accessor :ip, :port  
#ask for Victim infos  
def initialize( )  
puts “Victim infos:.”  
puts "Ip Address: "  
puts “Ip Address: #{@ip = gets.to\_s}”  
puts "Remote Port: "  
puts “Remote Port: #{@port = gets.to\_i}”  
end  
#connect to the Victim computer  
def connect( ) # I want to use the Net::Telnet library in this  
method  
#CODE finish here

someone know the way to do it; I know complex method but if there’s a  
simple way to do it …

---

<div class="post-metadata">

**Author:** ![Mathspeedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@Mathspeedy](https://www.ruby-forum.com/u/Mathspeedy)\
**Post date:** [May 13, 2009, 2:15am UTC](https://www.ruby-forum.com/t/embedding-a-library-into-a-method/167826/2 "2009-05-13T02:15:40Z")

</div>

Could someone ANSWER my QUESTION please …

---

<div class="post-metadata">

**Author:** ![Mathspeedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@Mathspeedy](https://www.ruby-forum.com/u/Mathspeedy)\
**Post date:** [May 13, 2009, 2:40am UTC](https://www.ruby-forum.com/t/embedding-a-library-into-a-method/167826/3 "2009-05-13T02:40:14Z")

</div>

Mathspeedy wrote:

> Hi all,  
> I wanted to embed the Net::Telnet into a method, just look my code …

Try copying some of the code from here…

[http://www.ruby-doc.org/stdlib/libdoc/net/telnet/rdoc/classes/Net/Telnet.html](http://www.ruby-doc.org/stdlib/libdoc/net/telnet/rdoc/classes/Net/Telnet.html)

---

<div class="post-metadata">

**Author:** ![Mathspeedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@Mathspeedy](https://www.ruby-forum.com/u/Mathspeedy)\
**Post date:** [May 13, 2009, 3:31am UTC](https://www.ruby-forum.com/t/embedding-a-library-into-a-method/167826/4 "2009-05-13T03:31:16Z")

</div>

On 12 mai, 20:37, Joel VanderWerf [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Mathspeedy wrote:
> 
> > Hi all,  
> > I wanted to embed the Net::Telnet into a method, just look my code …
> 
> Try copying some of the code from here…
> 
> [http://www.ruby-doc.org/stdlib/libdoc/net/telnet/rdoc/classes/Net/Tel](http://www.ruby-doc.org/stdlib/libdoc/net/telnet/rdoc/classes/Net/Tel)…
> 
> –  
> vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

I think I have an idea …
