Module: Xolo::Core::Loading
- Included in:
- Xolo
- Defined in:
- lib/xolo/core/loading.rb
Constant Summary collapse
- VERBOSE_LOADING_FILE =
touch this file to make mixins send text to stderr as things load or get mixed in
Pathname.new('/tmp/xolo-verbose-loading')
- VERBOSE_LOADING_ENV =
Or, set this ENV var to also make mixins send text to stderr
'XOLO_VERBOSE_LOADING'
Class Method Summary collapse
Instance Method Summary collapse
-
#load_msg(msg) ⇒ Object
Send a message to stderr if verbose loading is enabled.
-
#verbose_extend(extender, extendee) ⇒ Object
Mention that a module is being extended into something.
-
#verbose_include(includer, includee) ⇒ Object
Mention that a module is being included into something.
-
#verbose_inherit(child_class, parent_class) ⇒ Object
Mention that a module is being extended into something.
-
#verbose_loading? ⇒ Boolean
Only look at the filesystem once.
Class Method Details
.extended(extender) ⇒ Object
22 23 24 |
# File 'lib/xolo/core/loading.rb', line 22 def self.extended(extender) Xolo.verbose_extend extender, self end |
Instance Method Details
#load_msg(msg) ⇒ Object
Send a message to stderr if verbose loading is enabled
36 37 38 |
# File 'lib/xolo/core/loading.rb', line 36 def load_msg(msg) warn msg if verbose_loading? end |
#verbose_extend(extender, extendee) ⇒ Object
Mention that a module is being extended into something
46 47 48 |
# File 'lib/xolo/core/loading.rb', line 46 def verbose_extend(extender, extendee) load_msg "--> #{extender} is extending #{extendee}" end |
#verbose_include(includer, includee) ⇒ Object
Mention that a module is being included into something
41 42 43 |
# File 'lib/xolo/core/loading.rb', line 41 def verbose_include(includer, includee) load_msg "--> #{includer} is including #{includee}" end |
#verbose_inherit(child_class, parent_class) ⇒ Object
Mention that a module is being extended into something
51 52 53 |
# File 'lib/xolo/core/loading.rb', line 51 def verbose_inherit(child_class, parent_class) load_msg "--> #{child_class} is a Subclass inheriting from #{parent_class}" end |
#verbose_loading? ⇒ Boolean
Only look at the filesystem once.
27 28 29 30 31 32 33 |
# File 'lib/xolo/core/loading.rb', line 27 def verbose_loading? return @verbose_loading unless @verbose_loading.nil? @verbose_loading = VERBOSE_LOADING_FILE.file? @verbose_loading ||= ENV.include? VERBOSE_LOADING_ENV @verbose_loading end |