| Class | CorePlugins::ResourceManager::Resource |
| In: |
lib/webgen/plugins/coreplugins/resourcemanager.rb
|
| Parent: | Object |
The base class for all resources.
| name | [R] | The unique name of the resource. |
| output_path | [R] | The output path. |
| predefined | [RW] | Specifies if this resource is predefined. This is only used internally by webgen! |
| type | [RW] | The type of resource: file or memory. |
# File lib/webgen/plugins/coreplugins/resourcemanager.rb, line 47
47: def initialize( name, type, output_path )
48: @name = name
49: @type = type
50: @output_path = output_path.sub( /^\//, '' )
51: @used = false
52: end
Returns the complete destination path.
# File lib/webgen/plugins/coreplugins/resourcemanager.rb, line 60
60: def dest_path( root_dir )
61: File.join( root_dir, @output_path )
62: end
Mark the resource as referenced. Only referenced resources are written to the output directory.
# File lib/webgen/plugins/coreplugins/resourcemanager.rb, line 65
65: def referenced!
66: @referenced = true
67: end
Has the resource been used somewhere?
# File lib/webgen/plugins/coreplugins/resourcemanager.rb, line 70
70: def referenced?
71: @referenced
72: end
Returns the relative path from the node to the resource.
# File lib/webgen/plugins/coreplugins/resourcemanager.rb, line 55
55: def route_from( node )
56: node.route_to( '/' + @output_path )
57: end
Write the resource to the output directory.
# File lib/webgen/plugins/coreplugins/resourcemanager.rb, line 80
80: def write_resource( root_dir, file_handler )
81: raise NotImplementedError
82: end