Class: Presentation::SlideDSL

Inherits:
Object
  • Object
show all
Defined in:
lib/presentation/dsl.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/presentation/dsl.rb', line 35

def method_missing(method, *args, &block)
  if method =~ /(.*)_code$/
    code($1, *args, &block)
  else
    slide.send("#{method}=", *args, &block)
  end
end

Instance Method Details

#bullet(bullet) ⇒ Object Also known as: b



48
49
50
51
# File 'lib/presentation/dsl.rb', line 48

def bullet(bullet)
  slide.list ||= []
  slide.list << bullet
end

#code(language, text) ⇒ Object



43
44
45
46
# File 'lib/presentation/dsl.rb', line 43

def code(language, text)
  # TODO: find/create some sort of Gosu compatible syntax highlighter
  slide.code = text
end

#slideObject



31
32
33
# File 'lib/presentation/dsl.rb', line 31

def slide
  @slide ||= Slide.new
end