diff options
author | Xavier Noria <fxn@hashref.com> | 2010-02-06 16:11:21 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-02-06 16:11:21 +0100 |
commit | 7cb459eb60a27571fb68ad2919f071e13b38614d (patch) | |
tree | 53c6e99db1e50398b27637a748ea4fd0d2b22c3a /railties/guides/source/active_support_core_extensions.textile | |
parent | e3a95cb0e9eb7af00474d1ed633bfb8c7221d3b5 (diff) | |
download | rails-7cb459eb60a27571fb68ad2919f071e13b38614d.tar.gz rails-7cb459eb60a27571fb68ad2919f071e13b38614d.tar.bz2 rails-7cb459eb60a27571fb68ad2919f071e13b38614d.zip |
AS guide: documents Kernel#require_library_or_gem
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 5d0bc01fee..7a6abf40b6 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -422,6 +422,20 @@ end NOTE: Defined in +active_support/core_ext/kernel/reporting.rb+. +h4. +require_library_or_gem+ + +The convenience method +require_library_or_gem+ tries to load its argument with a regular +require+ first. If it fails loads +rubygems+ and tries again. + +If the first attempt is a failure and +rubygems+ can't be loaded the method raises +LoadError+. On the other hand, if +rubygems+ is available but the argument is not loadable as a gem, the method gives up and +LoadError+ is also raised. + +For example, that's the way the MySQL adapter loads the MySQL library: + +<ruby> +require_library_or_gem('mysql') +</ruby> + +NOTE: Defined in +active_support/core_ext/kernel/requires.rb+. + h3. Extensions to +Module+ h4. Aliasing |