------art_73884_22574689.1151463016615
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

require brings in the code so that you could do something like

FileUtils::Verbose::cp("methround.rb", "newmethround.rb")

include allows you to write something without the namespace (module in ruby)
in front of it hence being able to write:

cp("methround.rb", "newmethround.rb")

This has a good explanation especially if you come from a java background:

http://cwilliams.textdriven.com/articles/2006/04/20/namespacing-and-scoping-in-ruby

Cheers,
Jon Walker

On 6/27/06, Mark Sargent <coolboarderguy / gmail.com> wrote:
>
> HI All,
>
> with our volunteer teacher absent last night, our class was left to ponder
> things for ourselves. We were looking at a ruby equivalent for cp and came
> upon something that we all didn't understand. In the below code, small as
> it
> may be,
>
> #!/usr/local/bin/ruby
>
> require 'fileutils'
> include FileUtils::Verbose
> cp("methround.rb", "newmethround.rb")
>
>
> we wondered why we required to use require and include before the code
> would
> work. Naturally, if we removed the, "::Verbose" it still worked. Why
> require
> and then include fileutils? Cheers.
>
> Mark Sargent.
>
>


-- 
Jon Walker
joninsb / gmail.com

------art_73884_22574689.1151463016615--