@@ -129,16 +129,14 @@ def new_constants
129
129
130
130
# Add a set of modules to the watch stack, remembering the initial constants
131
131
def watch_namespaces ( namespaces )
132
- watching = [ ]
133
- namespaces . map do |namespace |
132
+ @watching << namespaces . map do |namespace |
134
133
module_name = Dependencies . to_constant_name ( namespace )
135
134
original_constants = Dependencies . qualified_const_defined? ( module_name ) ?
136
135
Inflector . constantize ( module_name ) . local_constants : [ ]
137
136
138
- watching << module_name
139
137
@stack [ module_name ] << original_constants
138
+ module_name
140
139
end
141
- @watching << watching
142
140
end
143
141
144
142
private
@@ -365,7 +363,7 @@ def require_or_load(file_name, const_path = nil)
365
363
366
364
# Record history *after* loading so first load gets warnings.
367
365
history << expanded
368
- return result
366
+ result
369
367
end
370
368
371
369
# Is the provided constant path defined?
@@ -434,7 +432,7 @@ def autoload_module!(into, const_name, qualified_name, path_suffix)
434
432
mod = Module . new
435
433
into . const_set const_name , mod
436
434
autoloaded_constants << qualified_name unless autoload_once_paths . include? ( base_path )
437
- return mod
435
+ mod
438
436
end
439
437
440
438
# Load the file at the provided path. +const_paths+ is a set of qualified
@@ -458,7 +456,7 @@ def load_file(path, const_paths = loadable_constants_for_path(path))
458
456
autoloaded_constants . concat newly_defined_paths unless load_once_path? ( path )
459
457
autoloaded_constants . uniq!
460
458
log "loading #{ path } defined #{ newly_defined_paths * ', ' } " unless newly_defined_paths . empty?
461
- return result
459
+ result
462
460
end
463
461
464
462
# Return the constant path for the provided parent and constant name.
@@ -505,7 +503,7 @@ def load_missing_constant(from_mod, const_name)
505
503
506
504
raise NameError ,
507
505
"uninitialized constant #{ qualified_name } " ,
508
- caller . reject { |l | l . starts_with? __FILE__ }
506
+ caller . reject { |l | l . starts_with? __FILE__ }
509
507
end
510
508
511
509
# Remove the constants that have been autoloaded, and those that have been
@@ -543,10 +541,7 @@ def get(key)
543
541
544
542
def safe_get ( key )
545
543
key = key . name if key . respond_to? ( :name )
546
- @store [ key ] || begin
547
- klass = Inflector . safe_constantize ( key )
548
- @store [ key ] = klass
549
- end
544
+ @store [ key ] ||= Inflector . safe_constantize ( key )
550
545
end
551
546
552
547
def store ( klass )
@@ -600,10 +595,10 @@ def will_unload?(const_desc)
600
595
def mark_for_unload ( const_desc )
601
596
name = to_constant_name const_desc
602
597
if explicitly_unloadable_constants . include? name
603
- return false
598
+ false
604
599
else
605
600
explicitly_unloadable_constants << name
606
- return true
601
+ true
607
602
end
608
603
end
609
604
@@ -631,10 +626,10 @@ def new_constants_in(*descs)
631
626
return new_constants unless aborting
632
627
633
628
log "Error during loading, removing partially loaded constants "
634
- new_constants . each { |c | remove_constant ( c ) } . clear
629
+ new_constants . each { |c | remove_constant ( c ) } . clear
635
630
end
636
631
637
- return [ ]
632
+ [ ]
638
633
end
639
634
640
635
# Convert the provided const desc to a qualified constant name (as a string).
@@ -663,7 +658,7 @@ def remove_constant(const) #:nodoc:
663
658
constantized . before_remove_const if constantized . respond_to? ( :before_remove_const )
664
659
parent . instance_eval { remove_const to_remove }
665
660
666
- return true
661
+ true
667
662
end
668
663
669
664
protected
0 commit comments