Module: Ronin::Static::Finders
Public Visibility
Public Instance Method Summary
| #each_static_dir(path, &block) |
Passes each matching static directory for the specified path to. |
|---|---|
| #each_static_file(path, &block) |
Passes each matching static file for the specified path to the. |
| #each_static_path(path, &block) |
Passes all matching static paths for the specified path to the. |
| #find_static_dir(path) |
Returns the first matching static directory for the specified. |
| #find_static_dirs(path) |
Returns all matching static directories for the specified path. |
| #find_static_file(path) |
Returns the first matching static file for the specified path. |
| #find_static_files(path) |
Returns all matching static files for the specified path. |
| #static_find(path) |
Returns the first matching static path for the specified path. |
| #static_find_all(path) |
Returns all matching static paths for the specified path. |
| #static_glob(pattern) |
Returns the first set of matching static paths for the specified. |
| #static_glob_all(pattern) |
Returns all matching static paths for the specified pattern. |
| #static_paths(path, &block) |
Passes all possible static paths for the specified path,. |
Public Instance Method Details
each_static_dir
Passes each matching static directory for the specified path to the given block.
147 148 149 |
# File 'lib/ronin/static/finders.rb', line 147 def each_static_dir(path,&block) find_static_dirs(path).each(&block) end |
each_static_file
Passes each matching static file for the specified path to the given block.
126 127 128 |
# File 'lib/ronin/static/finders.rb', line 126 def each_static_file(path,&block) find_static_files(path).each(&block) end |
each_static_path
Passes all matching static paths for the specified path to the given block.
105 106 107 |
# File 'lib/ronin/static/finders.rb', line 105 def each_static_path(path,&block) static_find_all(path).each(&block) end |
find_static_dir
Returns the first matching static directory for the specified path. If no matching static directory can be found, nil will be returned.
65 66 67 68 69 70 71 |
# File 'lib/ronin/static/finders.rb', line 65 def find_static_dir(path) static_paths(path) do |full_path| return full_path if File.directory?(full_path) end return nil end |
find_static_dirs
Returns all matching static directories for the specified path.
133 134 135 136 137 138 139 140 141 |
# File 'lib/ronin/static/finders.rb', line 133 def find_static_dirs(path) paths = [] static_paths(path) do |full_path| paths << full_path if File.directory?(full_path) end return paths end |
find_static_file
Returns the first matching static file for the specified path. If no matching static file can be found, nil will be returned.
52 53 54 55 56 57 58 |
# File 'lib/ronin/static/finders.rb', line 52 def find_static_file(path) static_paths(path) do |full_path| return full_path if File.file?(full_path) end return nil end |
find_static_files
Returns all matching static files for the specified path.
112 113 114 115 116 117 118 119 120 |
# File 'lib/ronin/static/finders.rb', line 112 def find_static_files(path) paths = [] static_paths(path) do |full_path| paths << full_path if File.file?(full_path) end return paths end |
static_find
Returns the first matching static path for the specified path. If no matching static path can be found, nil will be returned.
40 41 42 43 44 45 46 |
# File 'lib/ronin/static/finders.rb', line 40 def static_find(path) static_paths(path) do |full_path| return full_path if File.exists?(full_path) end return nil end |
static_find_all
Returns all matching static paths for the specified path.
91 92 93 94 95 96 97 98 99 |
# File 'lib/ronin/static/finders.rb', line 91 def static_find_all(path) paths = [] static_paths(path) do |full_path| paths << full_path if File.exists?(full_path) end return paths end |
static_glob
Returns the first set of matching static paths for the specified pattern. If no matching static paths can be found, an empty Array will be returned.
78 79 80 81 82 83 84 85 86 |
# File 'lib/ronin/static/finders.rb', line 78 def static_glob(pattern) static_paths(pattern) do |full_path| paths = Dir[full_path] return paths unless paths.empty? end return [] end |
static_glob_all
Returns all matching static paths for the specified pattern.
154 155 156 157 158 159 160 161 162 |
# File 'lib/ronin/static/finders.rb', line 154 def static_glob_all(pattern) paths = [] static_paths(pattern) do |full_path| paths += Dir[full_path] end return paths end |
static_paths
Passes all possible static paths for the specified path, within the static directories, to the specified block.
30 31 32 33 34 |
# File 'lib/ronin/static/finders.rb', line 30 def static_paths(path,&block) Static.static_dirs.each do |dir| block.call(File.join(dir,path)) end end |