class Revealize::FileSystemStore
Constants
- LAYOUTS_DIR
- SLIDES_DIR
- SLIDE_DECKS_DIR
Attributes
deck[R]
root_path[R]
Public Class Methods
new(root_path, slide_deck=nil)
click to toggle source
# File lib/revealize/file_system_store.rb, line 22 def initialize(root_path, slide_deck=nil) @root_path = root_path @deck = slide_deck end
Public Instance Methods
decks()
click to toggle source
# File lib/revealize/file_system_store.rb, line 27 def decks DeckList.new *deck_names end
read_deck(deck_name)
click to toggle source
# File lib/revealize/file_system_store.rb, line 31 def read_deck(deck_name) SlideDeckDsl.new(self).instance_eval(deck_file(deck_name)) @deck end
read_layout(layout_name)
click to toggle source
# File lib/revealize/file_system_store.rb, line 36 def read_layout(layout_name) @deck = SlideDeck.new(DeckTemplate.new(layout_file(layout_name))) end
read_slide(slide_name)
click to toggle source
# File lib/revealize/file_system_store.rb, line 40 def read_slide(slide_name) @deck.add_slide(create_slide(slide_name)) end
Private Instance Methods
create_slide(slide_name)
click to toggle source
# File lib/revealize/file_system_store.rb, line 58 def create_slide(slide_name) file_name = Dir[File.join(root_path, SLIDES_DIR, slide_name + '.*')].first raise SlideError.does_no_exist(slide_name) unless file_name if File.extname(file_name) == '.md' MarkdownSlide.new(File.read(file_name)) else HamlSlide.new(File.read(file_name)) end end
deck_file(deck_name)
click to toggle source
# File lib/revealize/file_system_store.rb, line 46 def deck_file(deck_name) File.read(File.join(root_path, SLIDE_DECKS_DIR, deck_name + '.deck')) end
deck_names()
click to toggle source
# File lib/revealize/file_system_store.rb, line 54 def deck_names Dir[File.join(root_path, SLIDE_DECKS_DIR, '*.deck') ].map {|f| File.basename(f,'.deck')} end
layout_file(layout_name)
click to toggle source
# File lib/revealize/file_system_store.rb, line 50 def layout_file(layout_name) File.read(File.join(root_path, LAYOUTS_DIR, layout_name + '.haml')) end