Methods
- #
- A
- C
- E
- F
- L
- N
- P
- S
- T
- U
Included Modules
Attributes
| [RW] | glob |
Class Public methods
new(root, current, paths, options = {}) Link
# 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) Link
autoload!(= @autoload = true) Link
# 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) Link
# 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) Link
# 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) Link
# 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() Link
concat(paths) Link
each(&block) Link
eager_load!(= @eager_load = true) Link
# 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) Link
# 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() Link
Returns all expanded paths but only if they exist in the filesystem.
existent_directories() Link
expanded() Link
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() Link
files_in(path) Link
first() Link
last() Link
load_path!(= @load_path = true) Link
# 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) Link
# 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() Link
skip_autoload!(= @autoload = false) Link
# 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) Link
# 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) Link
# 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) Link
# 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