Methods
Attributes
[R] | path | |
[RW] | glob |
Class Public methods
# File railties/lib/rails/paths.rb, line 107 107: def initialize(root, current, *paths) 108: options = paths.last.is_a?(::Hash) ? paths.pop : {} 109: super(paths.flatten) 110: 111: @current = current 112: @root = root 113: @glob = options[:glob] 114: 115: options[:autoload_once] ? autoload_once! : skip_autoload_once! 116: options[:eager_load] ? eager_load! : skip_eager_load! 117: options[:autoload] ? autoload! : skip_autoload! 118: options[:load_path] ? load_path! : skip_load_path! 119: end
Instance Public methods
Returns all expanded paths but only if they exist in the filesystem.
Expands all paths against the root and return all unique values.
This method is also aliased as
to_a
# File railties/lib/rails/paths.rb, line 153 153: def expanded 154: raise "You need to set a path root" unless @root.path 155: result = [] 156: 157: each do |p| 158: path = File.expand_path(p, @root.path) 159: 160: if @glob 161: if File.directory? path 162: result.concat expand_dir(path, @glob) 163: else 164: # FIXME: I think we can remove this branch, but I'm not sure. 165: # Say the filesystem has this file: 166: # 167: # /tmp/foobar 168: # 169: # and someone adds this path: 170: # 171: # /tmp/foo 172: # 173: # with a glob of "*", then this function will return 174: # 175: # /tmp/foobar 176: # 177: # We need to figure out if that is desired behavior. 178: result.concat expand_file(path, @glob) 179: end 180: else 181: result << path 182: end 183: end 184: 185: result.uniq! 186: result 187: end
Alias for expanded