Module: Kernel
- Defined in:
- lib/fastruby/custom_require.rb,
lib/fastruby/translator/translator_modules.rb
Overview
This file is part of the fastruby project, github.com/tario/fastruby
Copyright © 2011 Roberto Dario Seminara <[email protected]>
fastruby is free software: you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation, either version 3 of the license, or (at your option) any later version.
fastruby is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. see the gnu general public license for more details.
you should have received a copy of the gnu general public license along with fastruby. if not, see <www.gnu.org/licenses/>.
Instance Method Summary collapse
Instance Method Details
#fastruby_require(path) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fastruby/custom_require.rb', line 25 def fastruby_require(path) if path =~ /\.so$/ require(path) else FastRuby.logger.info "trying to load '#{path}'" complete_path = path + (path =~ /\.rb$/ ? "" : ".rb") $LOAD_PATH.each do |load_path| begin source = nil File.open(load_path + "/" + complete_path) do |file| source = file.read end FastRuby.logger.info "loading '#{load_path + "/" + complete_path}'" fastruby source return true rescue Errno::ENOENT end end raise LoadError end end |
#register_translator_module(modl) ⇒ Object
52 53 54 |
# File 'lib/fastruby/translator/translator_modules.rb', line 52 def register_translator_module(modl) FastRuby::TranslatorModules.instance.register_translator_module(modl) end |