Sha256: c21441b6887482b3ad77c457de0c06a8cd8fe3dff4ca0319647defff6286ba64
Contents?: true
Size: 808 Bytes
Versions: 1
Compression:
Stored size: 808 Bytes
Contents
class TokyoMetro::App::Renderer::ColorBox < TokyoMetro::Factory::Decorate::MetaClass def initialize( request , class_name: nil , size: :normal , text: nil ) super( request ) @class_name = set_class_name( class_name , size ) @text = text end def render h.render inline: <<-HAML , type: :haml , locals: h_locals %div{ class: class_name }< - if text.present? = text HAML end private def h_locals super.merge({ class_name: @class_name , text: @text }) end def set_class_name( class_name , size ) if class_name.present? class_name else case size when :normal :color_box_48 when :small :color_box_32 else raise "Error: The size \'#{ size }\' is not valid." end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tokyo_metro-0.10.1 | lib/tokyo_metro/app/renderer/color_box.rb |