FileUtils.cp

Hey,

It’s great to see that FileUtils has Unix friendly methods, so it feels
like
working in the shell. However, I’d prefer to just type cp and not
FileUtils.cp. Is there a way to import those methods into Kernel so I
don’t
have to qualify them all?

Thanks,
Mike

Michael P. Soulier wrote:

Hey,

It’s great to see that FileUtils has Unix friendly methods, so it feels
like
working in the shell. However, I’d prefer to just type cp and not
FileUtils.cp. Is there a way to import those methods into Kernel so I
don’t
have to qualify them all?

FileUtils is a module so you can #include or #extend.

Hello !

It’s great to see that FileUtils has Unix friendly methods, so it feels like
working in the shell. However, I’d prefer to just type cp and not
FileUtils.cp. Is there a way to import those methods into Kernel so I don’t
have to qualify them all?

include FileUtils

Vince

On 23/09/06 Vincent F. said:

include FileUtils

Ah, perfect. I didn’t realize that it was a module.

Mike

Michael P. Soulier wrote:

include FileUtils

Ah, perfect. I didn’t realize that it was a module.

Try

ri FileUtils

It does say it is a module… And anyway, it is a good reflex to look
at what ri is saying when you’d like to know something :wink: !

Vince

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs