Module: FlagIconSass::Rails::ViewHelpers

Defined in:
lib/flag-icon-sass/rails/helpers.rb

Instance Method Summary collapse

Instance Method Details

#flag_icon(cca2, squared = false, html_options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/flag-icon-sass/rails/helpers.rb', line 4

def flag_icon(cca2, squared = false, html_options = {})
  squared, html_options = false, squared if squared.is_a?(Hash)

  content_class = "flag-icon flag-icon-#{cca2}"
  content_class << " flag-icon-squared" if squared
  content_class << " #{html_options[:class]}" if html_options.key?(:class)
  html_options[:class] = content_class

  (:span, nil, html_options)
end