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

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/handlers/ruby/attribute_handler.rb

Overview

Handles attr_* statements in modules/classes

Instance Method Summary collapse

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:

Returns:

Raises:



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