Skip to content

Parser should be less strict about attribute arguments #1790

Description

@nevans

The prism parser (the only parser since v8.0.0) is strict about arguments to attr_reader, attr_writer, attr_accessor, and attr. It only parses as an attribute when all arguments are symbols.

As an example, the rdoc for Net::IMAP::Config intentionally took advantage of the looser parsing done by rdoc 7.2. Net::IMAP::Config defines its own versions of attr_reader, attr_writer and attr_accessor that add keyword arguments.

For example:

      # Seconds to wait until a connection is opened.
      #
      # Applied separately for establishing TCP connection and starting a TLS
      # connection.
      #
      # If the IMAP object cannot open a connection within this time,
      # it raises a Net::OpenTimeout exception.
      #
      # See Net::IMAP.new and Net::IMAP#starttls.
      #
      # The default value is +30+ seconds.
      attr_accessor :open_timeout, type: Integer, default: 30

rdoc 7.2 simply ignores the unknown keyword args, and parses this no differently from attr_accessor :open_timeout.

In my opinion, this is a bug in rdoc 8.0 which should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions