Sha256: de902eb7513678fec88c697f2902e874a7f29835445f6c6b769cfcccd724cf3f

Contents?: true

Size: 711 Bytes

Versions: 11

Compression:

Stored size: 711 Bytes

Contents

# 
# A thin wrapper around ActiveSupport::Autoload configured to always eager_load
# a child.  By calling `load_all!` on the namespace module, all children will
# be eager loaded, allowing us to more easily operate in a multi-threaded
# environment.
# 
module XDR::Namespace
  extend ActiveSupport::Concern

  included do
    extend ActiveSupport::Autoload
  end

  module ClassMethods
    def load_all!
      constants.each do |const_name|
        begin
          const = const_get const_name
          const.public_send :load_all! if const.respond_to? :load_all!
        rescue NameError => e
          raise e unless e.message =~ /uninitialized constant #{const_name}/
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
payshares-xdr-0.0.2 lib/xdr/namespace.rb
xdr-3.0.2 lib/xdr/namespace.rb
xdr-3.0.1 lib/xdr/namespace.rb
xdr-3.0.0 lib/xdr/namespace.rb
xdr-2.0.0 lib/xdr/namespace.rb
xdr-1.0.0 lib/xdr/namespace.rb
xdr-0.1.0 lib/xdr/namespace.rb
xdr-0.0.4 lib/xdr/namespace.rb
xdr-0.0.3 lib/xdr/namespace.rb
xdr-0.0.2 lib/xdr/namespace.rb
xdr-0.0.1 lib/xdr/namespace.rb