# Class: YARD::Handlers::Ruby::AttributeHandler

Inherits:
  Base
  - Object
  - Handlers::Base
  - Base
  - YARD::Handlers::Ruby::AttributeHandler
  show all

Defined in:
  lib/yard/handlers/ruby/attribute_handler.rb

## Overview

Handles `attr_*` statements in modules/classes

## Instance Method Summary collapse

- #validated_attribute_names(params) ⇒ Array<String> protected

  Strips out any non-essential arguments from the attr statement.

### Methods included from Parser::Ruby

#s

## Instance Method Details

### #validated_attribute_names(params) ⇒ `Array<String>` (protected)

Strips out any non-essential arguments from the attr statement.

Parameters:

- params (`Array<Parser::Ruby::AstNode>`) —

  a list of the parameters in the attr call.

Returns:

- (`Array<String>`) —

  the validated attribute names

Raises:

- (`Parser::UndocumentableError`) —

  if the arguments are not valid.

    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89

    # File 'lib/yard/handlers/ruby/attribute_handler.rb', line 78

    def validated_attribute_names(params)
      params.map do |obj|
        case obj.type
        when :symbol_literal
          obj.jump(:ident, :op, :kw, :const).source
        when :string_literal
          obj.jump(:string_content).source
        else
          raise YARD::Parser::UndocumentableError, obj.source
        end
      end
    end