Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!talisker.lacave.net!lacave.net!not-for-mail From: Brian Candler Newsgroups: comp.lang.ruby Subject: Re: assert_name doesn't exist as a function? Date: Wed, 20 Apr 2011 03:45:52 -0500 Organization: Service de news de lacave.net Lines: 37 Message-ID: References: <0b400c83ed884b0303d1f4a910bbf476@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1303289167 57812 65.111.164.187 (20 Apr 2011 08:46:07 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Wed, 20 Apr 2011 08:46:07 +0000 (UTC) In-Reply-To: X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381904 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:3223 Mike RegistrationErr wrote in post #993884: > I added this line: > require 'test/unit/assertions' > > Which is different from: > include Test::Unit::Assertions > > In PHP require and include are the same hence the confusion having come > from PHP. I don't understand the difference between require and include > in ruby yet, but at least my problem is sorted :) "require" means "go and load this ruby source file, if you've not loaded it before" "include" means (roughly) "add the methods in that module into the current class" "extend" means (roughly) "add the methods in that module into the current object" module Foo def bar puts "I am bar!" end end bar # doesn't work include Foo bar # now it works a = "Hello" a.extend Foo a.bar # this works too -- Posted via http://www.ruby-forum.com/.