Method: GraphQL::Client::ViewModule#eager_load!
- Defined in:
- lib/graphql/client/view_module.rb
permalink #eager_load! ⇒ Object
Public: Eager load module and all subdependencies.
Use in production when cache_classes is true.
Traverses all app/views/*/.erb and loads all static constants defined in ERB files.
Examples
Views.eager_load!
Returns nothing.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/graphql/client/view_module.rb', line 46 def eager_load! return unless File.directory?(load_path) Dir.entries(load_path).each do |entry| next if entry == "." || entry == ".." name = entry.sub(/(\.\w+)+$/, "").camelize.to_sym if ViewModule.valid_constant_name?(name) mod = const_defined?(name, false) ? const_get(name) : load_and_set_module(name) mod.eager_load! if mod end end nil end |