Class: Nanoc3::CodeSnippet
- Inherits:
-
Object
- Object
- Nanoc3::CodeSnippet
- Defined in:
- lib/nanoc3/base/code_snippet.rb
Overview
Nanoc3::CodeSnippet represent a piece of custom code of a nanoc site. It contains the textual source code as well as a mtime, which is used to speed up site compilation.
Instance Attribute Summary (collapse)
-
- (String) data
readonly
A string containing the actual code in this code snippet.
-
- (String) filename
readonly
The filename corresponding to this code snippet.
-
- (Time) mtime
readonly
The time where this code snippet was last modified.
-
- (Nanoc3::Site) site
The Site this code snippet belongs to.
Instance Method Summary (collapse)
-
- (CodeSnippet) initialize(data, filename, mtime = nil)
constructor
Creates a new code snippet.
-
- (void) load
Loads the code by executing it.
Constructor Details
- (CodeSnippet) initialize(data, filename, mtime = nil)
Creates a new code snippet.
compilation
nil)
39 40 41 42 43 |
# File 'lib/nanoc3/base/code_snippet.rb', line 39 def initialize(data, filename, mtime=nil) @data = data @filename = filename @mtime = mtime end |
Instance Attribute Details
- (String) data (readonly)
A string containing the actual code in this code snippet.
18 19 20 |
# File 'lib/nanoc3/base/code_snippet.rb', line 18 def data @data end |
- (String) filename (readonly)
The filename corresponding to this code snippet.
23 24 25 |
# File 'lib/nanoc3/base/code_snippet.rb', line 23 def filename @filename end |
- (Time) mtime (readonly)
The time where this code snippet was last modified.
28 29 30 |
# File 'lib/nanoc3/base/code_snippet.rb', line 28 def mtime @mtime end |
- (Nanoc3::Site) site
The Site this code snippet belongs to.
13 14 15 |
# File 'lib/nanoc3/base/code_snippet.rb', line 13 def site @site end |
Instance Method Details
- (void) load
This method returns an undefined value.
Loads the code by executing it.
48 49 50 |
# File 'lib/nanoc3/base/code_snippet.rb', line 48 def load eval(@data, TOPLEVEL_BINDING, @filename) end |