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

public each_static_dir(path, &block)

Passes each matching static directory for the specified path to the given block.

[View source]


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

public each_static_file(path, &block)

Passes each matching static file for the specified path to the given block.

[View source]


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

public each_static_path(path, &block)

Passes all matching static paths for the specified path to the given block.

[View source]


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

public find_static_dir(path)

Returns the first matching static directory for the specified path. If no matching static directory can be found, nil will be returned.

[View source]


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

public find_static_dirs(path)

Returns all matching static directories for the specified path.

[View source]


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

public find_static_file(path)

Returns the first matching static file for the specified path. If no matching static file can be found, nil will be returned.

[View source]


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

public find_static_files(path)

Returns all matching static files for the specified path.

[View source]


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

public static_find(path)

Returns the first matching static path for the specified path. If no matching static path can be found, nil will be returned.

[View source]


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

public static_find_all(path)

Returns all matching static paths for the specified path.

[View source]


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

public static_glob(pattern)

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.

[View source]


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

public static_glob_all(pattern)

Returns all matching static paths for the specified pattern.

[View source]


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

public static_paths(path, &block)

Passes all possible static paths for the specified path, within the static directories, to the specified block.

[View source]


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
Generated on Friday, September 25 2009 at 02:57:40 PM by YARD 0.2.3.5 (ruby-1.8.6).