Sha256: 5a29860c686db0cd1bb192315c128789e7d072723da6029782889b2b9a6f0a47

Contents?: true

Size: 906 Bytes

Versions: 26

Compression:

Stored size: 906 Bytes

Contents

# typed: false

module SorbetRails::Utils
  extend T::Sig

  sig { void }
  def self.rails_eager_load_all!
    # need to eager load to see all models
    Rails.configuration.eager_load_namespaces.each { |ns| ns.try(:eager_load!) }
    # Rails 6.0 change the loading logic to use Zeitwerk
    # https://github.com/rails/rails/blob/master/railties/lib/rails/application/finisher.rb#L116
    # But this is not applied to Rails.application.eager_load! method
    Zeitwerk::Loader.eager_load_all if defined?(Zeitwerk)
    # Let's eager_load more stuff so that we have the full picture of the runtime environment.
    # Also only applicable to Rails 6.
    if Rails.respond_to?(:autoloaders)
      Rails.autoloaders.each(&:eager_load)
    end
  end

  sig { params(method_name: String).returns(T::Boolean) }
  def self.valid_method_name?(method_name)
    !!method_name.match(/^[A-z][A-z0-9_]*[!?=]?$/)
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
sorbet-rails-0.7.34 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.33 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.32 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.31 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.27 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.26 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.25 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.24 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.23 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.22 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.20 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.19 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.18 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.5 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.4 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.3 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.2 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.1 lib/sorbet-rails/utils.rb
sorbet-rails-0.7.0 lib/sorbet-rails/utils.rb
sorbet-rails-0.6.5.1 lib/sorbet-rails/utils.rb