Module: RubyPatch::AutoLoad
- Defined in:
- lib/ruby_patch/auto_load.rb
Instance Method Summary collapse
-
#_file_name(name) ⇒ Object
You should use module Http; end rather than module HTTP; end.
- #const_missing(const_name) ⇒ Object
Instance Method Details
#_file_name(name) ⇒ Object
You should use module Http; end rather than module HTTP; end
13 14 15 16 17 |
# File 'lib/ruby_patch/auto_load.rb', line 13 def _file_name(name) "#{self}::#{name}".split('::').map{|t| t.sub(/\A([A-Z])/){$1.downcase}.gsub(/([A-Z])/){"_#{$1.downcase}"} }.join('/') + '.rb' end |
#const_missing(const_name) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/ruby_patch/auto_load.rb', line 3 def const_missing(const_name) begin require _file_name(const_name) self.const_get(const_name) rescue LoadError super end end |