Module: MaterialDesignIcons::IconHelper::Private

Extended by:
ActionView::Helpers::OutputSafetyHelper
Defined in:
lib/rails_material_design_icons/icon_helper.rb

Class Method Summary collapse

Class Method Details

.array_value(value = []) ⇒ Object



39
40
41
# File 'lib/rails_material_design_icons/icon_helper.rb', line 39

def self.array_value(value = [])
  value.is_a?(Array) ? value : value.to_s.split(/\s+/)
end

.icon_join(icon, text, reverse_order = false) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/rails_material_design_icons/icon_helper.rb', line 27

def self.icon_join(icon, text, reverse_order = false)
  return icon if text.blank?

  elements = [icon, ERB::Util.html_escape(text)]
  elements.reverse! if reverse_order
  safe_join(elements, ' ')
end

.icon_names(names = []) ⇒ Object



35
36
37
# File 'lib/rails_material_design_icons/icon_helper.rb', line 35

def self.icon_names(names = [])
  array_value(names).map { |n| "mdi-#{n}" }
end