Sha256: efef62f0aad939957e6047fc01f5c9930d97eda022e87b3ba4df2707c050b549
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module SlideHero class Slide include Compilable extend Pluggable attr_reader :headline, :headline_size, :transition, :background def initialize(headline=nil, headline_size: :medium, transition: :default, background: nil, &point_block) @headline = headline @headline_size = headline_size @transition = transition @background= background instance_eval(&point_block) if block_given? end create_plugs_for Note, Point, List, Code, Image, RemoteImage, Media def points @points ||= [] end private def size_to_markup { large: :h1, medium: :h2, small: :h3 }[headline_size] end def data_attributes "data-transition=\"#{transition}\"".tap do |attr| case when String(background).start_with?('http') attr << " data-background=\"#{background}\"" when String(background).include?('.') filename = background.gsub(/\s/, "%20") attr << " data-background=\"/images/#{filename}\"" when background attr << " data-background=\"#{background}\"" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slide_hero-0.0.10 | lib/slide_hero/slide.rb |