Class: ERBLint::Linters::ArgumentMappers::Flash
- Defined in:
- lib/primer/view_components/linters/argument_mappers/flash.rb
Overview
Maps classes in a flash element to arguments for the Flash component.
Constant Summary collapse
- SCHEME_MAPPINGS =
Primer::ViewComponents::Constants.get( component: "Primer::FlashComponent", constant: "SCHEME_MAPPINGS", symbolize: true ).freeze
Constants inherited from Base
Base::ATTRIBUTES, Base::DEFAULT_TAG
Instance Method Summary collapse
Methods inherited from Base
#attribute_to_args, #initialize, #map_classes, #system_arguments_to_args, #to_args, #to_s
Constructor Details
This class inherits a constructor from ERBLint::Linters::ArgumentMappers::Base
Instance Method Details
#classes_to_args(classes) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/primer/view_components/linters/argument_mappers/flash.rb', line 16 def classes_to_args(classes) classes.each_with_object({ classes: [] }) do |class_name, acc| next if class_name == "flash" if SCHEME_MAPPINGS[class_name] && acc[:scheme].nil? acc[:scheme] = SCHEME_MAPPINGS[class_name] elsif class_name == "flash-full" acc[:full] = true else acc[:classes] << class_name end end end |