map_arguments

in lib/primer/view_components/linters/flash_component_migration_counter.rb [18:33]


      def map_arguments(tag, tag_tree)
        
        return nil if tag_tree[:children].size != 1
        
        return nil if tag_tree[:children].first.is_a?(Hash)

        content = tag_tree[:children].first

        
        return nil if content.type != :text || content.children&.any? { |n| n.try(:type) == :erb }

        ARGUMENT_MAPPER.new(tag).to_s
      rescue ArgumentMappers::ConversionError
        nil
      end