Method: ERBLint::Linters::ArgumentMappers::Base#to_args

Defined in:
lib/primer/view_components/linters/argument_mappers/base.rb

#to_argsObject


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/primer/view_components/linters/argument_mappers/base.rb', line 27

def to_args
  args = {}

  args[:tag] = ":#{@tag.name}" unless self.class::DEFAULT_TAG.nil? || @tag.name == self.class::DEFAULT_TAG

  @tag.attributes.each do |attribute|
    attr_name = attribute.name

    if self.class::ATTRIBUTES.include?(attr_name)
      args.merge!(attribute_to_args(attribute))
    elsif attr_name == "class"
      args.merge!(map_classes(attribute))
    else
      # Assume the attribute is a system argument.
      args.merge!(SystemArguments.new(attribute).to_args)
    end
  end

  args
end