Class: Gollum::Macro::Flash

Inherits:
Gollum::Macro show all
Defined in:
lib/gollum-lib/macro/flash.rb

Instance Method Summary collapse

Methods inherited from Gollum::Macro

#initialize, instance

Constructor Details

This class inherits a constructor from Gollum::Macro

Instance Method Details

#render(message, icon = '', type = '') ⇒ Object



4
5
6
7
8
# File 'lib/gollum-lib/macro/flash.rb', line 4

def render(message, icon='', type='')
  flash_type = ['warn', 'error', 'success'].include?(type) ? "flash-#{type}" : '' 
  flash_icon = icon.empty? ? '' : %Q(data-gollum-icon="#{icon}")
  %Q(<div class="flash #{flash_type} my-2" #{flash_icon}>#{message}</div>)
end