Sha256: 6c41caaa1a261d88e1098a12d9b495866401458afaa10f2b28d5d52fdfe1e07a

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

require 'forwardable'

module RevealCK
  #
  # Public: A Presentation is slide html and metadata. Access html via
  # #html. Access metadata via theme, title, author, transition.
  #
  class Presentation
    include Retrieve
    extend Forwardable
    [:author, :title, :transition, :theme].each do |name|
      def_delegators :@config, name, "#{name}=".to_sym
    end

    def revealjs_config
      @config.revealjs_config
    end

    attr_accessor :html, :config

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

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

    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

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

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reveal-ck-3.5.1 lib/reveal-ck/presentation.rb
reveal-ck-3.5.0 lib/reveal-ck/presentation.rb
reveal-ck-3.4.0 lib/reveal-ck/presentation.rb
reveal-ck-3.3.1 lib/reveal-ck/presentation.rb
reveal-ck-3.3.0 lib/reveal-ck/presentation.rb
reveal-ck-3.2.0 lib/reveal-ck/presentation.rb
reveal-ck-3.1.0 lib/reveal-ck/presentation.rb