Class: Dokkit::TaskLib::Render

Inherits:
Base
  • Object
show all
Defined in:
lib/dokkit/tasklib/render.rb

Overview

Render task library defines a set of rake tasks devoted to the transformation (rendering) of the documents and data files.

Instance Attribute Summary collapse

Attributes inherited from Base

#ns

Instance Method Summary collapse

Constructor Details

#initialize(ns = 'render') {|_self| ... } ⇒ Render

Initialize a set of tasks that transform resources.

namespace

is the namespace for the tasks defined in the library.

logger

is the logger instance.

factory

is a factory class that creates document instances.

document_fns

is an array of source filenames.

data_fns

is an array of data files.

Yields:

  • (_self)

Yield Parameters:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dokkit/tasklib/render.rb', line 26

def initialize(ns = 'render')
  super
  
  yield self if block_given?

  @document_fns ||= []
  @data_fns ||= []

  define_tasks

end

Instance Attribute Details

#data_fnsObject

Returns the value of attribute data_fns.



18
19
20
# File 'lib/dokkit/tasklib/render.rb', line 18

def data_fns
  @data_fns
end

#document_fnsObject

Returns the value of attribute document_fns.



18
19
20
# File 'lib/dokkit/tasklib/render.rb', line 18

def document_fns
  @document_fns
end

#loggerObject

Returns the value of attribute logger.



18
19
20
# File 'lib/dokkit/tasklib/render.rb', line 18

def logger
  @logger
end

#resource_factoryObject

Returns the value of attribute resource_factory.



18
19
20
# File 'lib/dokkit/tasklib/render.rb', line 18

def resource_factory
  @resource_factory
end

Instance Method Details

#get_data(data_fn) ⇒ Object

use factory to get an instance of Dokkit::Resource::Data starting from data filename. Note that Data instances are immutable resources, that is no rendering process occurs: the file is copied as is.



48
49
50
# File 'lib/dokkit/tasklib/render.rb', line 48

def get_data(data_fn)
  @resource_factory.get(:data, data_fn)
end

#get_document(document_fn) ⇒ Object

Use factory to get an instance of Dokkit::Resource::Document starting from document filename.



40
41
42
# File 'lib/dokkit/tasklib/render.rb', line 40

def get_document(document_fn)
  @resource_factory.get(:document, document_fn)  
end