Class: Keydown::SlideDeck

Inherits:
Object
  • Object
show all
Defined in:
lib/keydown/slidedeck.rb

Defined Under Namespace

Classes: Context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ SlideDeck

Returns a new instance of SlideDeck.



11
12
13
14
15
16
17
18
19
# File 'lib/keydown/slidedeck.rb', line 11

def initialize(text)
  @title = ''
  @slides = []
  @text = text

  set_title
  extract_classnames!
  build_slides
end

Instance Attribute Details

#slidesObject (readonly)

Returns the value of attribute slides.



9
10
11
# File 'lib/keydown/slidedeck.rb', line 9

def slides
  @slides
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/keydown/slidedeck.rb', line 8

def title
  @title
end

Instance Method Details

#to_htmlObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/keydown/slidedeck.rb', line 21

def to_html
  require 'tilt'

  css_files = ['css/keydown.css']
  css_files += Dir.glob('css/*.css')
  css_files.uniq!

  extension_dirs = Dir.glob('deck.js/extensions/*').select {|f| File.directory? f}
  extension_css = extension_dirs.inject([]) do |files, dir|
    files += Dir.glob("#{dir}/*.css")
    files
  end

  context = Context.new(:title => @title,
                        :css_files => css_files,
                        :js_files => Dir.glob('js/**/*.js') || [],
                        :slides => @slides,
                        :extensions_js_files => Dir.glob('deck.js/extensions/**/*.js') || [],
                        :extensions_css_files => extension_css)

  template = Tilt.new(File.join(Tasks.template_dir, 'index.html.haml'))
  template.render(context)
end