Class: RhetButler::SlideGroup
- Inherits:
-
YamlType
show all
- Includes:
- Enumerable
- Defined in:
- lib/rhet-butler/slide-group.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from YamlType
#check_config_hash, #init_with, #initialize, register, #value_from_config
Instance Attribute Details
#html_classes ⇒ Object
Returns the value of attribute html_classes.
55
56
57
|
# File 'lib/rhet-butler/slide-group.rb', line 55
def html_classes
@html_classes
end
|
Returns the value of attribute metadata.
55
56
57
|
# File 'lib/rhet-butler/slide-group.rb', line 55
def metadata
@metadata
end
|
#slides ⇒ Object
Returns the value of attribute slides.
54
55
56
|
# File 'lib/rhet-butler/slide-group.rb', line 54
def slides
@slides
end
|
Class Method Details
.optional_config ⇒ Object
10
11
12
|
# File 'lib/rhet-butler/slide-group.rb', line 10
def optional_config
%w[type slide_type html_class html_classes html_id]
end
|
.required_config ⇒ Object
14
15
16
|
# File 'lib/rhet-butler/slide-group.rb', line 14
def required_config
%w[slides]
end
|
Instance Method Details
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/rhet-butler/slide-group.rb', line 37
def configure
value_from_config("html_id") do |value|
@html_id = value
end
value_from_config("html_classes") do |value|
@html_classes += [*value]
end
value_from_config("html_class") do |value|
@html_classes << value
end
@slides = @config_hash.delete('slides')
@metadata = @config_hash
end
|
#each ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/rhet-butler/slide-group.rb', line 57
def each
if block_given?
@slides.each{|slide| yield(slide)}
else
@slides.each
end
end
|
#each_slide ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/rhet-butler/slide-group.rb', line 65
def each_slide
if block_given?
@slides.each do |slide|
if slide.is_a? SlideGroup
slide.each_slide{|sl| yield sl}
else
yield slide
end
end
else
enum_for :each_slide
end
end
|
#id_attr ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/rhet-butler/slide-group.rb', line 83
def id_attr
if @html_id.nil?
return ""
else
"id='#@html_id'"
end
end
|
#normalize_config(coder) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/rhet-butler/slide-group.rb', line 26
def normalize_config(coder)
case coder.type
when :map
coder.map
when :scalar
raise "A slide group needs to at least be a list of slides"
when :seq
{ 'slides' => coder.seq}
end
end
|
#setup_defaults ⇒ Object
19
20
21
22
23
24
|
# File 'lib/rhet-butler/slide-group.rb', line 19
def setup_defaults
@html_id = nil
@html_classes = ["group"]
@slides = []
@metadata = {}
end
|
#template_name ⇒ Object
79
80
81
|
# File 'lib/rhet-butler/slide-group.rb', line 79
def template_name
"group.html"
end
|