Skip to Content Skip to Search
Methods
#
A
C
E
F
L
N
P
S
T
U
Included Modules

Attributes

[RW] glob

Class Public methods

new(root, current, paths, options = {})

# File railties/lib/rails/paths.rb, line 129
def initialize(root, current, paths, options = {})
  @paths   = paths
  @current = current
  @root    = root
  @glob    = options[:glob]
  @exclude = options[:exclude]

  options[:autoload_once] ? autoload_once! : skip_autoload_once!
  options[:eager_load]    ? eager_load!    : skip_eager_load!
  options[:autoload]      ? autoload!      : skip_autoload!
  options[:load_path]     ? load_path!     : skip_load_path!
end

Instance Public methods

<<(path)

# File railties/lib/rails/paths.rb, line 181
def <<(path)
  @paths << path
end

autoload!(= @autoload = true)

# File railties/lib/rails/paths.rb, line 169
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) }
    files.sort
  end
    

autoload?(= @autoload)

# File railties/lib/rails/paths.rb, line 171
    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) }
        files.sort
      end
  end
end

autoload_once!(= @autoload_once = true)

# File railties/lib/rails/paths.rb, line 161
def autoload_once! = @autoload_once = true
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)

autoload_once?(= @autoload_once)

# File railties/lib/rails/paths.rb, line 163
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) }
    

children()

# File railties/lib/rails/paths.rb, line 146
def children
  keys = @root.keys.find_all { |k|
    k.start_with?(@current) && k != @current
  }
  @root.values_at(*keys.sort)
end

concat(paths)

# File railties/lib/rails/paths.rb, line 186
def concat(paths)
  @paths.concat paths
end

each(&block)

# File railties/lib/rails/paths.rb, line 177
def each(&block)
  @paths.each(&block)
end

eager_load!(= @eager_load = true)

# File railties/lib/rails/paths.rb, line 165
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) }
    files.

eager_load?(= @eager_load)

# File railties/lib/rails/paths.rb, line 167
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) }
    files.sort
  end

existent()

Returns all expanded paths but only if they exist in the filesystem.

# File railties/lib/rails/paths.rb, line 230
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

existent_directories()

# File railties/lib/rails/paths.rb, line 241
def existent_directories
  expanded.select { |d| File.directory?(d) }
end

expanded()

Expands all paths against the root and return all unique values.

# File railties/lib/rails/paths.rb, line 211
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

expanded_files()

# File railties/lib/rails/paths.rb, line 245
def expanded_files
  expanded.select { |file| !File.extname(file).empty? }
end

files_in(path)

# File railties/lib/rails/paths.rb, line 252
def files_in(path)
  files = Dir.glob(@glob, base: path, sort: false)
  files -= @exclude if @exclude
  files.map! { |file| File.join(path, file) }
  files.sort
end

first()

# File railties/lib/rails/paths.rb, line 153
def first
  expanded.first
end

last()

# File railties/lib/rails/paths.rb, line 157
def last
  expanded.last
end

load_path!(= @load_path = true)

# File railties/lib/rails/paths.rb, line 173
      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) }
          files.sort
        end
    end
  end
end

load_path?(= @load_path)

# File railties/lib/rails/paths.rb, line 175
  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) }
      files.sort
    end
end

paths()

# File railties/lib/rails/paths.rb, line 198
def paths
  raise "You need to set a path root" unless @root.path

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

skip_autoload!(= @autoload = false)

# File railties/lib/rails/paths.rb, line 170
  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) }
      files.sort
    end
end

skip_autoload_once!(= @autoload_once = false)

# File railties/lib/rails/paths.rb, line 162
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) }

skip_eager_load!(= @eager_load = false)

# File railties/lib/rails/paths.rb, line 166
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) }
    files.sort

skip_load_path!(= @load_path = false)

# File railties/lib/rails/paths.rb, line 174
    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) }
        files.sort
      end
  end
end

to_ary()

# File railties/lib/rails/paths.rb, line 194
def to_ary
  @paths
end

unshift(*paths)

# File railties/lib/rails/paths.rb, line 190
def unshift(*paths)
  @paths.unshift(*paths)
end