instance method skip_autoload_once!

Ruby on Rails edge

Since edge

Signature

skip_autoload_once!(= @autoload_once = false)

No documentation comment.

Parameters

= @autoload_once = false req
Source
# File railties/lib/rails/paths.rb, line 163
      def skip_autoload_once! = @autoload_once = false
      def autoload_once? = @autoload_once

      def eager_load! = @eager_load = true
      def skip_eager_load! = @eager_load = false
      def eager_load? = @eager_load

      def autoload! = @autoload = true
      def skip_autoload! = @autoload = false
      def autoload? = @autoload

      def load_path! = @load_path = true
      def skip_load_path! = @load_path = false
      def load_path? = @load_path

      def each(&block)
        @paths.each(&block)
      end

      def <<(path)
        @paths << path
      end
      alias :push :<<

      def concat(paths)
        @paths.concat paths
      end

      def unshift(*paths)
        @paths.unshift(*paths)
      end

      def to_ary
        @paths
      end

      def paths
        raise "You need to set a path root" unless @root.path

        map do |p|
          Pathname.new(@root.path).join(p)
        end
      end

      def extensions # :nodoc:
        $1.split(",") if @glob =~ /\{([\S]+)\}/
      end

      # Expands all paths against the root and return all unique values.
      def expanded
        raise "You need to set a path root" unless @root.path
        result = []

        each do |path|
          path = File.expand_path(path, @root.path)

          if @glob && File.directory?(path)
            result.concat files_in(path)
          else
            result << path
          end
        end

        result.uniq!
        result
      end

      # Returns all expanded paths but only if they exist in the filesystem.
      def existent
        expanded.select do |f|
          does_exist = File.exist?(f)

          if !does_exist && File.symlink?(f)
            raise "File #{f.inspect} is a symlink that does not point to a valid file"
          end
          does_exist
        end
      end

      def existent_directories
        expanded.select { |d| File.directory?(d) }
      end

      def expanded_files
        expanded.select { |file| !File.extname(file).empty? }
      end

      alias to_a expanded

      private
        def files_in(path)
          files = Dir.glob(@glob, base: path, sort: false)
          files -= @exclude if @exclude
          files.map! { |file| File.join(path, file) }

Defined in railties/lib/rails/paths.rb line 163 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Paths::Path

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close