class SmartIoC::BeanFileLoader
Public Class Methods
new()
click to toggle source
# File lib/smart_ioc/bean_file_loader.rb, line 2 def initialize @loaded_locations = {} @load_proc = Proc.new { |location| load(location) } end
Public Instance Methods
clear_locations()
click to toggle source
# File lib/smart_ioc/bean_file_loader.rb, line 26 def clear_locations @loaded_locations = {} end
require_bean(bean_name)
click to toggle source
@param bean_name [Symbol] bean name return nil
# File lib/smart_ioc/bean_file_loader.rb, line 14 def require_bean(bean_name) locations = SmartIoC::BeanLocations.get_bean_locations(bean_name).values.flatten locations.each do |location| next if @loaded_locations.has_key?(location) @loaded_locations[location] = true @load_proc.call(location) end nil end
set_load_proc(&block)
click to toggle source
# File lib/smart_ioc/bean_file_loader.rb, line 7 def set_load_proc(&block) raise ArgumentError, "block should be given" unless block_given? @load_proc = block end