Method: Path.register_loader
- Defined in:
- lib/path/load.rb
.register_loader(*extensions) {|path| ... } ⇒ Object
Registers a new loader (a block which will be called with the Path to load) for the given extensions (either with the leading dot or not)
Path.register_loader('.marshal') { |file| Marshal.load file.read }
13 14 15 16 17 |
# File 'lib/path/load.rb', line 13 def self.register_loader(*extensions, &loader) extensions.each { |ext| LOADERS[Path.dotted_ext(ext)] = loader } end |