Class: RevealCK::Presentation

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Retrieve
Defined in:
lib/reveal-ck/presentation.rb

Overview

Public: A Presentation is slide html and metadata. Access html via #html. Access metadata via theme, title, author, transition.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Retrieve

included, #retrieve

Constructor Details

#initialize(args) ⇒ Presentation

Returns a new instance of Presentation.



21
22
23
24
# File 'lib/reveal-ck/presentation.rb', line 21

def initialize(args)
  @html = ''
  @config = retrieve(:config, args)
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



19
20
21
# File 'lib/reveal-ck/presentation.rb', line 19

def config
  @config
end

#htmlObject

Returns the value of attribute html.



19
20
21
# File 'lib/reveal-ck/presentation.rb', line 19

def html
  @html
end

Class Method Details

.from_dsl(args) ⇒ Object



39
40
41
42
43
# File 'lib/reveal-ck/presentation.rb', line 39

def self.from_dsl(args)
  file = retrieve(:file, args)
  config = retrieve(:config, args)
  RevealCK::PresentationDSL.load file: file, config: config
end

.from_template(args) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/reveal-ck/presentation.rb', line 30

def self.from_template(args)
  file = retrieve(:file, args)
  config = retrieve(:config, args)
  presentation = Presentation.new config: config
  template = Templates::Processor.open(file: file, config: config)
  presentation.html = template.output
  presentation
end

.load(args) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/reveal-ck/presentation.rb', line 45

def self.load(args)
  file = retrieve(:file, args)
  config = retrieve(:config, args)
  if file.end_with? '.rb'
    Presentation.from_dsl file: file, config: config
  else
    Presentation.from_template file: file, config: config
  end
end

Instance Method Details

#add(content) ⇒ Object



26
27
28
# File 'lib/reveal-ck/presentation.rb', line 26

def add(content)
  @html << content.html
end

#revealjs_configObject



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

def revealjs_config
  @config.revealjs_config
end