Class: RevealCK::Templates::Processor

Inherits:
Object
  • Object
show all
Includes:
Retrieve
Defined in:
lib/reveal-ck/templates/processor.rb

Overview

Public: A Processor is given a template and expected to render it.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Retrieve

included, #retrieve

Constructor Details

#initialize(args) ⇒ Processor

Returns a new instance of Processor.



17
18
19
20
21
# File 'lib/reveal-ck/templates/processor.rb', line 17

def initialize(args)
  @config = retrieve(:config, args)
  file = retrieve(:file, args)
  @template = Tilt.new file
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



15
16
17
# File 'lib/reveal-ck/templates/processor.rb', line 15

def config
  @config
end

Class Method Details

.open(args) ⇒ Object



28
29
30
31
32
# File 'lib/reveal-ck/templates/processor.rb', line 28

def self.open(args)
  file = retrieve(:file, args)
  config = retrieve(:config, args)
  Processor.new(file: file, config: config)
end

Instance Method Details

#output(locals = {}) ⇒ Object



23
24
25
26
# File 'lib/reveal-ck/templates/processor.rb', line 23

def output(locals = {})
  scope = RevealCK::Render::Scope.new(dir: Dir.pwd, config: config)
  @template.render scope, locals
end