Class: Nanoc3::CodeSnippet

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.

Attributes

Instance Attributes

data [R] public

A string containing the actual code in this code snippet.

filename [R] public

The filename corresponding to this code snippet.

mtime [R] public

The time where this code snippet was last modified.

site [RW] public

The Nanoc3::Site this code snippet belongs to.

Constructor Summary

public initialize(data, filename, mtime = nil)

Creates a new code snippet.

data:The raw source code which will be executed before compilation.
filename:The filename corresponding to this code snippet.
mtime:The time when the code was last modified (can be nil).
[View source]


29
30
31
32
33
# File 'lib/nanoc3/base/code_snippet.rb', line 29

def initialize(data, filename, mtime=nil)
  @data     = data
  @filename = filename
  @mtime    = mtime
end

Public Visibility

Public Instance Method Summary

#load

Loads the code by executing it.

Public Instance Method Details

load

public load

Loads the code by executing it.

[View source]


36
37
38
# File 'lib/nanoc3/base/code_snippet.rb', line 36

def load
  eval(@data, TOPLEVEL_BINDING, @filename)
end
Generated on Sunday, August 09 2009 at 01:43:13 PM by YARD 0.2.3.2 (ruby-1.8.7).