Class: Slideck::Loader Private

Inherits:
Object
  • Object
show all
Defined in:
lib/slideck/loader.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for loading slides

Instance Method Summary collapse

Constructor Details

#initialize(read_handler) ⇒ Loader

Create a Loader instance

Examples:

Slideck::Loader.new(File)

Parameters:

  • read_handler (#read)

    the read handler for slides



17
18
19
# File 'lib/slideck/loader.rb', line 17

def initialize(read_handler)
  @read_handler = read_handler
end

Instance Method Details

#load(location) ⇒ String

Load slides from a location

Examples:

loader.load("slides.md")

Parameters:

  • location (String)

    the location of the slides to load

Returns:

  • (String)

    the slides content

Raises:



35
36
37
38
39
40
41
42
43
# File 'lib/slideck/loader.rb', line 35

def load(location)
  if location.nil?
    raise ReadError, "the location for the slides must be given"
  end

  @read_handler.read(location)
rescue SystemCallError => err
  raise ReadError, err.message
end