Module: SassFunctions::PaymentIcons

Included in:
SassC::Script::Functions
Defined in:
lib/sass_functions/payment_icons.rb

Instance Method Summary collapse

Instance Method Details

#payment_iconsObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sass_functions/payment_icons.rb', line 6

def payment_icons
  pattern = ::PaymentIcons::Engine.root.join('app', 'assets', 'images', 'payment_icons', '*.svg')
  icons = Dir.glob(pattern).map do |icon_path|
    icon_name = File.basename(icon_path, '.svg')
    svg_name = SassC::Script::Value::String.new(icon_name)
    class_name = SassC::Script::Value::String.new(icon_name.dasherize)

    SassC::Script::Value::List.new([svg_name, class_name], separator: :space)
  end

  SassC::Script::Value::List.new(icons, separator: :space)
end