class RhetButler::Slide
Attributes
config_hash[R]
content[RW]
content_filters[RW]
html_classes[RW]
html_id[RW]
note_filters[RW]
notes[RW]
raw_content[RW]
raw_notes[RW]
template_name[R]
Public Class Methods
optional_config()
click to toggle source
# File lib/rhet-butler/slide.rb, line 8 def optional_config %w[ title html_id html_classes html_class notes filters note_filters ] end
required_config()
click to toggle source
# File lib/rhet-butler/slide.rb, line 15 def required_config %w[content] end
Public Instance Methods
classes()
click to toggle source
# File lib/rhet-butler/slide.rb, line 108 def classes @html_classes.join(" ") end
configure()
click to toggle source
# File lib/rhet-butler/slide.rb, line 49 def configure value_from_config("title") do |title| @html_id = title.downcase.split(/\s/).join("-") end value_from_config("content") do |content| @raw_content = content end value_from_config("notes") do |notes| @raw_notes = notes end 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 value_from_config("filters") do |value| @content_filters = value @html_classes += [*value].map do |filter| filter.html_class end.compact end value_from_config("note-filters") do |value| @note_filters = value @html_classes += value.map do |filter| "notes-" + filter.html_class unless filter.html_class.nil? end end end
id_attr()
click to toggle source
# File lib/rhet-butler/slide.rb, line 100 def id_attr if @html_id.nil? return "" else "id='#@html_id'" end end
initialize_copy(source)
click to toggle source
Calls superclass method
# File lib/rhet-butler/slide.rb, line 28 def initialize_copy(source) super @config_hash = source.config_hash.dup unless source.config_hash.nil? @content = source.content.dup unless source.content.nil? @notes = source.notes.dup unless source.notes.nil? @html_id = source.html_id.dup unless source.html_id.nil? @html_classes = source.html_classes.dup unless source.html_classes.nil? end
normalize_config(coder)
click to toggle source
# File lib/rhet-butler/slide.rb, line 38 def normalize_config(coder) case coder.type when :map coder.map when :scalar { 'content' => coder.scalar.to_s } when :seq { 'content' => coder.seq.to_a } end end
setup_defaults()
click to toggle source
# File lib/rhet-butler/slide.rb, line 20 def setup_defaults @template_name = "slide.html" @html_classes = ["slide"] @html_id = nil @raw_notes = "" @type = nil end
to_s()
click to toggle source
# File lib/rhet-butler/slide.rb, line 96 def to_s "Slide: #{content.nil? ? "R:#{raw_content[0..20]}" : content[0..20]}" end