Class: RhetButler::Includer

Inherits:
YamlType show all
Includes:
Enumerable
Defined in:
lib/rhet-butler/slide-includer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from YamlType

#check_config_hash, register, #setup_defaults, #value_from_config

Constructor Details

#initializeIncluder

Returns a new instance of Includer.



9
10
11
# File 'lib/rhet-butler/slide-includer.rb', line 9

def initialize
  @slides = []
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



20
21
22
# File 'lib/rhet-butler/slide-includer.rb', line 20

def path
  @path
end

#slidesObject (readonly)

Returns the value of attribute slides.



21
22
23
# File 'lib/rhet-butler/slide-includer.rb', line 21

def slides
  @slides
end

Instance Method Details

#eachObject



23
24
25
26
27
28
29
# File 'lib/rhet-butler/slide-includer.rb', line 23

def each
  if block_given?
    @slides.each{|slide| yield slide}
  else
    @slides.each
  end
end

#init_with(coder) ⇒ Object



13
14
15
16
17
18
# File 'lib/rhet-butler/slide-includer.rb', line 13

def init_with(coder)
  unless coder.type == :scalar
    raise "!include with non-scalar - use a path string"
  end
  @path = coder.scalar
end

#load(loader) ⇒ Object



31
32
33
34
35
# File 'lib/rhet-butler/slide-includer.rb', line 31

def load(loader)
  loader = loader.dup
  @slides = loader.load_file(path)
  loader
end