Module: Autoloaded
- Defined in:
- lib/autoloaded.rb,
lib/autoloaded/version.rb,
lib/autoloaded/autoloader.rb,
lib/autoloaded/specification.rb
Defined Under Namespace
Modules: Deprecation, Inflection, Warning Classes: Autoloader, LoadPathedDirectory, Specification, Specifications
Constant Summary collapse
- VERSION =
The current version of the Autoloaded project.
'2.4.0'
Class Method Summary collapse
-
.module {|Autoloader| ... } ⇒ Array of Array
(also: class)
Autoloads constants that match files in the source directory.
-
.warn(enabling) { ... } ⇒ Object
Enables or disables warning messages depending on the specified enabling argument.
-
.warn? ⇒ true, false
Indicates whether warning messages are enabled or disabled.
Class Method Details
.module {|Autoloader| ... } ⇒ Array of Array Also known as: class
Autoloads constants that match files in the source directory.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/autoloaded.rb', line 58
module(&block)
raise(::LocalJumpError, 'no block given (yield)') unless block
yield(autoloader = Autoloader.new(block.binding))
autoloader.autoload!
end
# Enables or disables warning messages depending on the specified _enabling_
# argument.
#
# @param [Object] enabling disables warnings if +nil+ or +false+
#
# @yield if a block is given, the value of _#warn?_ is reset after the block is
# called
#
# @return if a block is given, the result of calling the block
# @return [Autoloaded] if a block is not given, _Autoloaded_ (_Module_)
#
# @since 1.3
#
# @see .warn?
def self.warn(enabling, &block)
result = Warning.enable(enabling, &block)
block ? result : self
end
# Indicates whether warning messages are enabled or disabled.
#
# @return [true] if warning messages are enabled
# @return [false] if warning messages are disabled
#
# @since 1.3
#
# @see .warn
def self.warn?
Warning.enabled?
end
class << self
alias_method :class, :module
end
end
|