Sha256: 519e7e3841ec7e8c8e0d4d1012ad39bc6553bbb3ffd50b0cd435ed510f6bf37f

Contents?: true

Size: 681 Bytes

Versions: 4

Compression:

Stored size: 681 Bytes

Contents

class SmartIoC::BeanFileLoader
  def initialize
    @loaded_locations = {}
  end

  # @param bean_name [Symbol] bean name
  # return nil
  def require_bean(bean_name)
    locations = SmartIoC::BeanLocations.get_bean_locations(bean_name)

    # load *.rb file if extra bean location was added or it was not loaded yet
    location_count = locations.values.flatten.size

    if !@loaded_locations.has_key?(bean_name) || @loaded_locations[bean_name] != location_count
      locations.each do |package_name, locations|
        locations.each do |location|
          require location
        end
      end

      @loaded_locations[bean_name] = location_count
    end

    nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smart_ioc-0.1.17 lib/smart_ioc/bean_file_loader.rb
smart_ioc-0.1.16 lib/smart_ioc/bean_file_loader.rb
smart_ioc-0.1.14 lib/smart_ioc/bean_file_loader.rb
smart_ioc-0.1.13 lib/smart_ioc/bean_file_loader.rb