[prog] Ruby require question
jennyw
jennyw at dangerousideas.com
Tue Mar 7 16:06:57 EST 2006
Hi, Rachel!
Rachel McConnell wrote:
> In Ruby, dependencies are declared by:
>
> require 'somestring'
>
> However, as far as I can tell, the string passed to the require method
> doesn't need to match up with the actual name of a gem, or a non-gem
> package (if such still exist). How can I tell what package to install
> to fulfil the dependency?
The argument to require is a library name, which is searched in the
directories listed in the global array $: (I don't know why they don't
know why there isn't a friendly name for that ...). These are often .rb
files, but can also be .so, .dll, etc. This name would probably rarely
match a gem name, since gems typically include multiple files. For
example, Rails includes active_record.rb -- if all you saw was code that
had 'require "active_record"' in it, it'd be hard to guess the gem name.
So ... you might do a Google search for somestring.rb and see if
something out there matches that name. Or search RAA (Ruby Application
Archive) or RubyForge.
Or you can try posting the code in question and we can try to help.
Good luck!
Jen
More information about the Programming
mailing list