Class: Slidict::Generator
- Inherits:
-
Object
- Object
- Slidict::Generator
- Defined in:
- lib/slidict/generator.rb
Overview
Framework-independent application API for integrations such as slidict.io. It turns source prose into both a Deck and presentation source without involving CLI input/output or the filesystem.
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
- #generate(text:, topic: nil, duration: nil, audience: nil, goal: nil, framework: "slidev", language: nil, presentation_method: nil) ⇒ Object
-
#initialize(client:, renderer: Output::Renderer.new) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
Instance Method Details
#generate(text:, topic: nil, duration: nil, audience: nil, goal: nil, framework: "slidev", language: nil, presentation_method: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/slidict/generator.rb', line 15 def generate(text:, topic: nil, duration: nil, audience: nil, goal: nil, framework: "slidev", language: nil, presentation_method: nil) source = text.to_s.strip raise ArgumentError, "text must not be empty" if source.empty? deck = Deck.new( topic: topic || title_from(source), duration: duration, audience: audience, goal: goal || "communicate the source text clearly", framework: framework, presentation_method: presentation_method, source: source ) = @client.(deck, language: language) generated_deck = Deck.new( topic: deck.topic, duration: deck.duration, audience: deck.audience, goal: deck.goal, framework: deck.framework, slides: , presentation_method: deck.presentation_method, source: source ) Result.new(deck: generated_deck, content: @renderer.render(generated_deck)) end |