Top Level Namespace
Defined Under Namespace
Modules: ActiveRecord, ActiveSupport, Breakpoint, ClassInheritableAttributes, DB2, DRb, Dependencies, IRB, Inflector, Test Classes: Binding, Class, Fixture, Fixtures, Hash, Logger, Module, Mysql, NilClass, Numeric, Object, String
Constant Summary collapse
Instance Method Summary collapse
-
#assert(&block) ⇒ Object
See Breakpoint.assert.
-
#breakpoint(id = nil, &block) ⇒ Object
See Breakpoint.breakpoint.
-
#require_library_or_gem(library_name) ⇒ Object
Method that requires a library, ensuring that rubygems is loaded This is used in the database adaptors to require DB drivers.
- #silence_warnings ⇒ Object
Instance Method Details
#assert(&block) ⇒ Object
See Breakpoint.assert
523 524 525 526 527 |
# File 'lib/active_record/support/breakpoint.rb', line 523 def assert(&block) Binding.of_caller do |context| Breakpoint.assert(context, &block) end end |
#breakpoint(id = nil, &block) ⇒ Object
See Breakpoint.breakpoint
516 517 518 519 520 |
# File 'lib/active_record/support/breakpoint.rb', line 516 def breakpoint(id = nil, &block) Binding.of_caller do |context| Breakpoint.breakpoint(id, context, &block) end end |
#require_library_or_gem(library_name) ⇒ Object
Method that requires a library, ensuring that rubygems is loaded This is used in the database adaptors to require DB drivers. Reasons: (1) database drivers are the only third-party library that Rails depend upon (2) they are often installed as gems
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/active_record/connection_adapters/abstract_adapter.rb', line 8 def require_library_or_gem(library_name) begin require library_name rescue LoadError => cannot_require # 1. Requiring the module is unsuccessful, maybe it's a gem and nobody required rubygems yet. Try. begin require 'rubygems' rescue LoadError => rubygems_not_installed raise cannot_require end # 2. Rubygems is installed and loaded. Try to load the library again begin require library_name rescue LoadError => gem_not_installed raise cannot_require end end end |
#silence_warnings ⇒ Object
1 2 3 4 5 6 7 8 |
# File 'lib/active_record/support/misc.rb', line 1 def silence_warnings old_verbose, $VERBOSE = $VERBOSE, nil begin yield ensure $VERBOSE = old_verbose end end |