Sha256: 40317bdf8146c8f9e1060b287feff81a92a03ad1a7e4f0ffd08aee41508c2216
Contents?: true
Size: 936 Bytes
Versions: 1
Compression:
Stored size: 936 Bytes
Contents
class TokyoMetro::App::Renderer::Icon::FontAwesome < TokyoMetro::Factory::Decorate::MetaClass def initialize( request , icon_name , size = 1 , spin: nil , pulse: nil , inverse: nil ) raise if spin and pulse raise "Error" if ( spin or pulse ) and !( [ "circle-o-notch" , "cog" , "gear" , "refresh" , "spinner" ].include?( icon_name ) ) super( request ) @icon_name = icon_name @size = size @spin = spin @pulse = pulse @inverse = inverse end def render h.render inline: <<-HAML , type: :haml , locals: h_locals = content_tag( :i , "" , class: classes ) HAML end private def classes ary = [ :fa , "fa-#{ @icon_name }" , "fa-#{ @size }x" ] if @spin ary << [ "fa-spin" ] elsif @pulse ary << [ "fa-pulse" ] end if @inverse ary << [ "fa-inverse" ] end ary end def h_locals super().merge({ classes: classes }) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tokyo_metro-0.10.1 | lib/tokyo_metro/app/renderer/icon/font_awesome.rb |