Parent

Methods

Included Modules

Class Index [+]

Quicksearch

Webgen::Source::Resource

This class is used to provide access to sources provided by resources.

Attributes

glob[R]

The glob (see File.fnmatch) specifying the resources.

paths_glob[R]

The glob (see File.fnmatch) specifying the paths that should be used from the resources.

strip_prefix[R]

The prefix that should optionally be stripped from the paths.

Public Class Methods

new(glob, paths_glob = nil, strip_prefix = nil) click to toggle source

Create a new resource source for the the glob and use only those paths matching paths_glob while stripping strip_prefix off the path.

    # File lib/webgen/source/resource.rb, line 25
25:     def initialize(glob, paths_glob = nil, strip_prefix = nil)
26:       @glob, @paths_glob, @strip_prefix = glob, paths_glob, strip_prefix
27:     end

Public Instance Methods

paths() click to toggle source

Return all paths associated with the resources identified by #.

    # File lib/webgen/source/resource.rb, line 30
30:     def paths
31:       if !defined?(@paths)
32:         stack = Stacked.new
33:         website.config['resources'].select {|name, infos| File.fnmatch(@glob, name)}.sort.each do |name, infos|
34:           stack.add([['/', Webgen::Common.const_for_name(infos.first).new(*infos[1..1])]])
35:         end
36:         @paths = stack.paths
37:         @paths = @paths.select {|p| File.fnmatch(@paths_glob, p)} if @paths_glob
38:         @paths.collect! {|p| p.mount_at('/', @strip_prefix)} if @strip_prefix
39:       end
40:       @paths
41:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.