Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / core_ext / module / loading.rb
1 class Module
2 # Returns String#underscore applied to the module name minus trailing classes.
3 #
4 # ActiveRecord.as_load_path # => "active_record"
5 # ActiveRecord::Associations.as_load_path # => "active_record/associations"
6 # ActiveRecord::Base.as_load_path # => "active_record" (Base is a class)
7 #
8 # The Kernel module gives an empty string by definition.
9 #
10 # Kernel.as_load_path # => ""
11 # Math.as_load_path # => "math"
12 def as_load_path
13 if self == Object || self == Kernel
14 ''
15 elsif is_a? Class
16 parent == self ? '' : parent.as_load_path
17 else
18 name.split('::').collect do |word|
19 word.underscore
20 end * '/'
21 end
22 end
23 end